0

Possible Duplicate:
php image display without download in mail

I have a PHP web application which create wishes card and send them with the PHP mail() function. The wishes card is build with HTML and part of the card are illustrations, those illustrations use jpg images inside an IMG tag. The images are hosted on a server so images paths use a complete link (like http:/domain.com/img.jpg).

When the card is received, for exemple with thunderbird, it says images are blocked and the user has to click on a button to show the images. I understand it's a security mesure. That's still annoying for a whishes card which is meant to be discover with its illustrations.

So, i'm looking for any though, any light, in a way to prevent email clients from blocking images.

Thanks.

Community
  • 1
  • 1
Aurélien Grimpard
  • 918
  • 10
  • 24

2 Answers2

2

Image blocking is done on the receiver's end, by the mail client. There's nothing you can do about it.

It is because of this that you often see the

Can't see this email? View it here

(Or something similar) at the top of many emails. This is your best alternative.

George
  • 36,413
  • 9
  • 66
  • 103
1

Embed the image in the email, I strongly recommend something like phpMailer to do this.

From their documentation:

Inline Attachments

There is an additional way to add an attachment. If you want to make a HTML e-mail with images incorporated into the desk, it's necessary to attach the image and then link the tag to it. For example, if you add an image as inline attachment with the CID my-photo, you would access it within the HTML e-mail with &ltimg src="cid:my-photo" alt="my-photo" />.

In detail, here is the function to add an inline attachment: $mail->AddEmbeddedImage(filename, cid, name); By using this function with this example's value above, results in this code: $mail->AddEmbeddedImage('my-photo.jpg', 'my-photo', 'my-photo.jpg ');

Dale
  • 10,384
  • 21
  • 34