zeckdude
zeckdude

Reputation: 16163

How can I force email programs to show images send in html email using php?

I am sending an html email with php and it includes an image. Some email programs, such as gMail have a 'display images' button. The user has to click on that in order for the images in the email to show up.

Is there any way I can force email programs to show images that are sent within html emails generated by php?

Upvotes: 9

Views: 26376

Answers (7)

abend
abend

Reputation: 483

The last place I worked, we were sending out emails that had images in them that would come up automatically, in outlook at least, without me having to explicitly click a show images button.

When I inquired, another developer explained that they simply copied the encoded block of the image from an already sent email into the body of the email. I think this may be a weird sort of workaround they stumbled upon. I don't know if this adds more weight than an attachment, but I could see how an email reader would see an attachment and then ask the user as opposed to read it already in the body and just show it...

Upvotes: 0

Guildencrantz
Guildencrantz

Reputation: 1915

Email is hugely variable, and in general you're going to see different results in different places. That being said: There's no general way to force an email client to display images; this is why most email now includes a link at the top indicating that if it doesn't display correctly the user should click on it (which then takes the user to a standard HTML page outside the email client's image/javascript/everything-else-blocking grasp).

You specifically mention gmail so it's worth pointing out that if you embed (CID URI) the images they won't show inline, they'll show as attachments at the bottom of the message.

Upvotes: 2

DCD
DCD

Reputation: 1290

You can, but unfortunatley Trident, which is the IE rendering engine doesn't support it (surprise, surprise), but it is technically possible to include images in the html itself - see http://en.wikipedia.org/wiki/Data_URI_scheme

Upvotes: 0

amelvin
amelvin

Reputation: 9051

Doubt it, it would be a security issue if the 'src' of an image opened up a cross site scripting attack.

Cross site request forgery

Customers of a bank in Mexico were attacked in early 2008 with an image tag in email and were sent through their home routers to the wrong website.

Upvotes: 1

Quentin
Quentin

Reputation: 943510

As a rule of thumb, email clients are configured to display attached images by default (e.g. those with a cid: URI scheme) and not load remote images (which can include tracking information).

If you attach all the images, then you'll usually get them showing up (while inflating your SMTP bandwidth use along with that of your recipients (which can make you unpopular)).

Upvotes: 15

Levi Hackwith
Levi Hackwith

Reputation: 9332

I'm afraid not. The main reason email programs block images is because images are often used to 'report back' to whoever sent the email that the email has been opened. This is a common tactic used by spammers. Also, malicious code is often attached to images and downloading these images is how such code gets executed. Another reason email programs block images.

Upvotes: 5

nosklo
nosklo

Reputation: 222852

No, you can't force programs you didn't write yourself to do anything.

Upvotes: 4

Related Questions