Hi all
Actually I have some data and I want to send it to some email id
when user clicks on the command button the data (in fact a string ) should b send to the hard coded email id.
how can I do it?
Nahush.
Printable View
Hi all
Actually I have some data and I want to send it to some email id
when user clicks on the command button the data (in fact a string ) should b send to the hard coded email id.
how can I do it?
Nahush.
Open a project, put following controls.
TextBox called txtSendTo
TextBox callled txtSubject
TextBox called txtMessage
MAPIMessages called MAPIMessages1
MAPISession called MAPISession1
Commandbutton called cmdSend
-----------------------
To Add MAPI controls
-----------------------
Click on Project Menu -> Components and find Microsoft MAPI Controls and check that box and press OK.
Now you should have 2 more controls in Toolbox on the left hand side. Just add them to the form.
-----------------------
and the following code should do it.
VB Code:
Private Sub cmdSend_Click() If Trim(txtSendTo.Text) = "" Then MsgBox "Please enter an email address to send EMail.", vbInformation, MSGBoxTitle Else MAPISession1.SignOn With MAPIMessages1 .MsgIndex = -1 .RecipDisplayName = txtSendTo.Text .MsgSubject = txtSubject.Text .MsgNoteText = txtMessage.Text .SessionID = MAPISession1.SessionID .Send End With MsgBox "Message sent.", vbInformation, MSGBoxTitle MAPISession1.SignOff End If End Sub
Cheers
the code above requires outlook express
But can be there any possibility that even if the computer with
outlook not installed should also send the msg.
i.e inspite of the outlook (or NE other mail prgm ) the mail should
be sent to the resipient
Nahush
in that case u might want to look at SMTP stuff. But unfortunately I haven't got any code for that. Sorry.
Search for SMTP :afrog:
goto http://www,codehound.com/vb
in the search box, enter VBSendMail. Click Search (or GO, or what ever the button is).
Sift through the results, there's plenty of examples on this.
TG
Hi All!!!
I M trying to send mail but a need your help.
i have microsoft outlook with one address and outlook express with another address and when i m sending ,mail it sends with the mail of the microsoft outlook and i want to send the mail with the address in the outlook express .
what should i do ?
10x