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?

Comments

Michsk’s picture

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

jwilson3’s picture

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. :(

NoahPollock’s picture

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!

Michsk’s picture

- 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

NoahPollock’s picture

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...

Michsk’s picture

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.

Christopher Herberte’s picture

Status: Active » Closed (fixed)
bryancasler’s picture

I have to re-open this.

To eliminate as many issues as possible I have disabled all the settings here admin/settings/htmlmail/settings

In my body text of a test email I placed the following.

<p>
	WITH ALT ABSOLUTE<br />
	<img alt="TEST1" src="http://www.ivawbeta.org/sites/default/files/resize/remote/9317221e7543d22362aa04678e7c141c-250x188.jpg" /><br />
	<br />
	WITH ALT RELATIVE<br />
	<img alt="TEST2" src="/sites/default/files/resize/remote/9317221e7543d22362aa04678e7c141c-250x188.jpg" /><br />
	<br />
	NO ALT ABSOLUTE<br />
	<img src="http://www.ivawbeta.org/sites/default/files/resize/remote/9317221e7543d22362aa04678e7c141c-250x188.jpg" /><br />
	<br />
	NO ALT RELATIVE<br />
	<img src="/sites/default/files/resize/remote/9317221e7543d22362aa04678e7c141c-250x188.jpg" /><br />
	&nbsp;</p>

The output in gmail with all setting options turned off

<p>
	WITH ALT ABSOLUTE<br>
	<img alt="TEST1"><br>
	<br>
	WITH ALT RELATIVE<br>
	<img alt="TEST2"><br>
	<br>
	NO ALT ABSOLUTE<br>
	<img><br>
	<br>
	NO ALT RELATIVE<br>
	<img><br>
	&nbsp;</p>

If I go back to the settings page and turn all options on, this is the output in gmail.

<td valign="top">
            <p>
	WITH ALT ABSOLUTE<br><br><img alt="TEST1"></p>
<p>	WITH ALT RELATIVE<br><br><img alt="TEST2"></p>
<p>	NO ALT ABSOLUTE<br><br><img></p>
<p>	NO ALT RELATIVE<br><br><img><br><br>
	&nbsp;</p>
            </td>
meishme’s picture

Has this issue been resolved?

I'm having problems similar to #5 were inline images do not appear at the emails, but appear at the website. Looking at the source code of the emails, there is no Only local images are allowed. tag at all... Like it disappears.

I also tried adding images via CCK. Same goes... They appear on the website, but not on the emails. Interestingly enough, the labels of the CCK fiels do appear on the emails, but no image.

Other tags (such as <h1>, <h2>, etc) work perfectly fine. I don't believe it's input filter either as I've tested this over and over again... Plus the website version seems to display the items correctly.

meishme’s picture

Category: feature » bug
Status: Closed (fixed) » Active

Sorry guys, need to reopen this as it's still an issue.

thinkround’s picture

same as #9. img tags do not show at all in email bodies...

At which point by which module/component are img tags removed?

Anyone? Any clue?

thinkround’s picture

for me this issue has been resolved as I found that the img tags were filtered out by the simplenews module because the settings were on plain text emails. When I changed this to html all was fine.

pillarsdotnet’s picture

Status: Active » Closed (works as designed)

Closing as it appears the problem lies outside the htmlmail module.