|
| ||||||||||
| Tags: email, microsoft, visual basic, visual studio, winodows xp |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| how to send email in vb
Try Dim Msg As MailMessage = New MailMessage() Dim MailObj As New SmtpClient("smtp.mccombs.utexas.edu") Msg.From = New MailAddress("littlemic14@yahoo.com", "Michelle Solis") Msg.To.Add(New MailAddress("michelle.solis@bba07.mccombs.utexas.edu", "Michelle Solis")) Msg.IsBodyHtml = CBool("False") Msg.Body = "this is the email body" Msg.Subject = "this is the subject" MailObj.Send(Msg) Catch ex As Exception MsgBox(ex.ToString) End Try End Sub |
|
#2
| |||
| |||
| Re: how to send email in vb
Well I want you to just try out the bellow code and see to it whether it helps you or not : Code: Option Explicit
Private Sub Command1_Click()
Dim objSession As Object
Dim objMessage As Object
Dim objRecipient As Object
'Create the Session Object.
Set objSession = CreateObject("mapi.session")
'Logon using the session object.
'Specify a valid profile name if you want to.
'Avoid the logon dialog box.
objSession.Logon profileName:="MS Exchange Settings"
'Add a new message object to the OutBox.
Set objMessage = objSession.Outbox.Messages.Add
'Set the properties of the message object.
objMessage.subject = "This is a test."
objMessage.Text = "This is the message text."
'Add a recipient object to the objMessage.Recipients collection.
Set objRecipient = objMessage.Recipients.Add
'Set the properties of the recipient object.
objRecipient.Name = "John Doe" '<---Replace this with a valid
'display name or e-mail alias
'Type can be ActMsgTo, mapiTo, or CdoTo for different CDO versions;
'they all have a constant value of 1.
objRecipient.Type = mapiTo
objRecipient.Resolve
'Send the message.
objMessage.Send showDialog:=False
MsgBox "Message sent successfully!"
'Logoff using the session object.
objSession.Logoff
End Sub |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "how to send email in vb" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unable to send email with jpeg's/mp3's attachment to a Verizon phone using Opera's email client | Tawannah | Technology & Internet | 4 | 23-08-2011 08:04 AM |
| Unable to send email from email alias via Microsoft Office 365 | FrancoL | Windows Software | 6 | 10-07-2011 08:26 PM |
| "send page by email" and "send link by email" disabled in Internet Explorer 8 | Bindaas-ER | Technology & Internet | 4 | 27-02-2011 03:32 AM |
| Windows live mail couldn't send email but can receive email | danielyen | Windows Software | 1 | 15-07-2010 12:17 AM |
| Cannot send internal email to a external email host like hotmail, gmail, yahoo, gmx etc... | Antonio00 | Small Business Server | 2 | 14-02-2008 08:16 PM |