how to add images to htmlmail emails

Newsance - October 1, 2009 - 11:25
Project:HTML Mail
Version:6.x-1.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi,

I can't figure out how to include images in the html mail. I tried to enclose refernce as background-image:url(''); in the css code, or embed it in the message as a html instruction, or in the footer or header - nothing worked. Any ideas?

#1

lasac - October 15, 2009 - 11:43

you must upload them to a location, and call for them with url's, like http://www.yousite.com/sites/all/themes/yourtheme/images/img.jpg

#2

jrguitar21 - October 23, 2009 - 04:13
Title:Images » how to add images to htmlmail emails

lasac is right, for images to appear, you must be sure you're referencing the image file absolutely as a fully qualified URI. I think there might be a feature request to change absolute paths (URLS starting with / and relative to webroot) into absolute URIs (including protocol://servername.tld:port/path/to/file.jpg), and if there is not, there should be :)

Also, you mention the CSS property background-image in your original post...

Gmail and other email clients have been known to strip the CSS background properties even if you're inlining them (i.e., <div style="background-image:url(...)">) or using the emogrifier to embed them on the fly with class attributes. AFAIK, the only way to effectively use background images in HTML emails is inside the TABLE and TD tags, because they support the "background" attribute. Luckily, you can simulate both background-image and background-color css properties with ATTRIBUTES of the TABLE/TD tag.

Interesting and unfortunate side note: the Emogrifier is currently not smart enough to turn css background properties that happen to be applied to TABLE or TD tags into their appropriate background or bgcolor attribute counterpart. :(

#3

NoahPollock - October 30, 2009 - 01:37

I am able to get an image into the header using html mail. However, I am unable to get an image to appear in the body of the emails. I am using the standard html code ie img src="http://www.website.com/image4.jpg" with brackets in both the template (header) and the body of the message. I have put input as "full html".

I am testing newsletter using gmail.

Any ideas?

Thanks!

#4

lasac - November 1, 2009 - 20:40

- are you sure you are linking correctly to the image?
- have you checked in google the download images button?

may sound dumb questions but sometimes you look over them

#5

NoahPollock - November 3, 2009 - 01:36

Hi Isaac,
Yes - I do both. The images appear fine in the newsletter content - on the website, but not in the email - unless it is in the header...

#6

lasac - November 3, 2009 - 09:19

check the source of your recieved email, you will see what happends. I do not know how or even if its posible in google (can´t imagine its not posible). I do know its posible in outlook and thunderbird.

 
 

Drupal is a registered trademark of Dries Buytaert.