Adding images to an HTML email

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Adding images to an HTML email

Post by social_experiment »

I'm sending HTML emails but i want to add an image as background for the email. Do i store the image on a web-server and reference it using CSS?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Adding images to an HTML email

Post by requinix »

It's possible not to, but yes you put it on the server.

But a heads up: background images are notoriously unsupported/not shown in email clients.
User avatar
mecha_godzilla
Forum Contributor
Posts: 375
Joined: Wed Apr 14, 2010 4:45 pm
Location: UK

Re: Adding images to an HTML email

Post by mecha_godzilla »

I'd second that - the HTML parsing engines in some email/web clients are truly awful, which is pretty dire considering that the target platform is still 4.01 Transitional. The email client on my reasonably recent smartphone can't even draw top and bottom borders for a 3 row/1 cell table to the same length in the same table. So good luck getting decent background image support :mrgreen:

As previously discussed, standard practice these days seems to be to host your images on a server. There are probably some benefits to this approach in respect of bandwidth issues, because you're moving the burden off of the mail server and on to your web server (where it arguably should be anyway). It might also be the case that some spam filters are more likely to block what it thinks is an unsolicited message if it has an attachment, because this technique was heavily used by spammers at one point - as long as the message gets through, the recipient sees the image, whereas if their servers had hosted the image then those servers might already have been taken offline or blacklisted by that point.

M_G
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Adding images to an HTML email

Post by social_experiment »

mecha_godzilla wrote:So good luck getting decent background image support
requinix wrote:background images are notoriously unsupported/not shown in email clients.
^ very true, using background-image in the css doesn't work so i have to go for <img > tags instead. thanks for the inputs on the matter
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Adding images to an HTML email

Post by Christopher »

social_experiment wrote:I'm sending HTML emails but i want to add an image as background for the email. Do i store the image on a web-server and reference it using CSS?
You can do this, but unfortunately background images are not supported by Microsoft Outlook -- which is a very common email client. Other web based email clients also do not support background images well. There is a workaround for Outlook (search the web for it).
(#10850)
Post Reply