Reputation: 154
I have a piece of code:
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set myMail = objOutlook.CreateItem(0)
myMail.To = "[email protected]"
myMail.Subject = "Happy Birthday"
myMail.Body= "Happy Birthday"
myMail.Send
Wait(3)
Set myMail = Nothing
Set objOutlook = Nothing
I want to add some pictures in the mail body.
Upvotes: 0
Views: 1163
Reputation: 3784
Try this code.
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set myMail = objOutlook.CreateItem(0)
myMail.To = "[email protected]"
myMail.Subject = "Happy Birthday"
strBody = "<p>Happy Birthday</p>"
strBody = strBody & "<img src='Your Image Path' alt='Some name (optional)' width='Some Width' height='Some Height'>"
'For example: "<img src='Your Image Path' alt='XYZ' width='50' height='50'>"
myMail.HTMLBody = strBody
myMail.Send
Wait(3)
Set myMail = Nothing
Set objOutlook = Nothing
Here you are drafting email body as html body and embedding an image in it.
Upvotes: 1