Category: ASP

How to embed image in HTML email

Dim objNewMail, strHTML
'Creates HTML body
strHTML ="

Hello Zarqawi,

strHTML = strHTML + ”

Long time no see. I can’t believe you are stealing copier sheets from Pentagon”
strHTML = strHTML + ”

V. Subhash

'Refers to an embedded image
strHTML = strHTML + "src="subhash.jpg" "
strHTML = strHTML + "

'Creates CDONTS NewMail object
Set objNewMail = Server.CreateObject("CDONTS.NewMail")

'Makes it an HTML e-mail
objNewMail.BodyFormat = CdoBodyFormatHTML
objNewMail.MailFormat = CdoMailFormatMime

'Specifies sender's e-mail address
objNewMail.From = "V. Subhash - GML <[email protected]>"

'Specifies recipient's e-mail address
objNewMail.To = "Al Zarqawi <[email protected]>"

'Specifies subject line
objNewMail.Subject = "Re: Cheap office supplies"

'Embeds image subhash_pps.jpg as subhash.jpg
objNewMail.AttachURL Server.MapPath(".") & "subhash_pps.jpg", "subhash.jpg"

'Specifies e-mail body
objNewMail.Body = strHTML

'Sends the e-mail

Set objNewMail = Nothing



How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.