By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Resizing an embedded image in an automatic HTML email created using classic ASP

P: 28
I am working on a project for a company intranet that requires an automatic HTML e-mail to be sent whenever a new note or an existing note is updated on an person's profile. The email should contain an image of the person. These images are stored on a server. I have managed to do this but problem is the code I have used does not allow me to resize the images to fit the e-mail formatting I have. If I try adding the style and border to the image tag in the code, it does not work. See code below. Any ideas?

Thanks

Expand|Select|Wrap|Line Numbers
  1. Dim Mailer
  2. Dim objCommand
  3. Set Mailer = Server.CreateObject("CDO.Message")
  4. Mailer.MimeFormatted = True
  5. Mailer.To = "you@yourdomain.com"
  6. Mailer.From = "you@yourdomain.com"
  7. Mailer.Subject = "Updates to notes"
  8. Mailer.HTMLBody = "<html><img src=""cid:personimage.jpg""></html>"
  9.  
  10. Set objCommand = Mailer.AddRelatedBodyPart(Server.MapPath("../images/personimage.jpg"), "personimage.jpg", CdoReferenceTypeName)
  11.  
  12.  
  13. objCommand.Fields.Item("urn:schemas:mailheader:Content-ID") = "<personimage.jpg>"
  14. objCommand.Fields.Update
  15.  
  16. Mailer.Send
  17.  
May 2 '12 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,369
Expand|Select|Wrap|Line Numbers
  1. <img src="someimage.jpg" height="20px" width="20px">
May 2 '12 #2

P: 28
Hi Rabbit, I tried that and it is not working
May 3 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.