views:

236

answers:

6

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?

+2  A: 

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

nosklo
Why was this down voted? I have the same problem with programs I _did_ write myself :)
Tim Post
A: 

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.

amelvin
+1  A: 

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.

Levi Hackwith
There are plenty of legitimate reasons for wanting to know if an email was opened as well. Many businesses use it to improve the quality of their email newsletters.
VirtuosiMedia
+5  A: 

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

David Dorward
A: 

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

DCD
+1  A: 

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.

Guildencrantz