VB 6 Send Email

VB Send Email with a HTML Format body

Private Sub Command1_Click()
Dim EmailList, Mailbod As String, Myfile
Dim objOutlook As Outlook.Application
Dim newapp As Outlook.MailItem, objRecip As Outlook.Recipient
Dim objRWhtm As Outlook.Attachment
Dim StrBody As String
Dim Myfile As String

StrBody=”<font color=’red’>Hello World</font>”
Set newapp = Outlook.Application.CreateItem(olMailItem)
Set objOutlook = CreateObject(“Outlook.Application”)
Set objRecip = newapp.Recipients.Add(“user@email.com”) ‘list of recipients for the message
‘Set objRWhtm = newapp.Attachments.Add(Myfile) ‘optional command if you want to attach a file
‘specify MyFile as file path for desired file to be sent
newapp.Subject = Mailbod ‘Sets the subject of the e-mail
newapp.HTMLBody = StrBody ‘send html format email
‘newapp.Body = “Hello World” ‘Plain Text Body
newapp.Send ‘Sends your e-mail
newapp.Display ‘Show you the e-mail you just sent.

End Sub


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>