Badshah
Badshah

Reputation: 69

php image display without download in mail

hi i want to send a image in html format using php mailer class but image show in mail after downloading. but i want to display the image without downloading. is there any option in mailer class or there is another method for this. or i have to send the the image in another format.

Upvotes: 0

Views: 1981

Answers (3)

Talha
Talha

Reputation: 1636

buddy, its really simple. Write html code as if you write in developing a web page. Give the complete url to the image in the src attribute.

Dont forget to user the function eregi_replace() on body html

$html_message = eregi_replace("[\]",'',$body_html_string);

engoy !!!!! ;)

Upvotes: 0

fire
fire

Reputation: 21531

If your using PHP Mailer...

$mail = new PHPMailer();    
$mail->SetFrom("[email protected]");
$mail->AddAddress("[email protected]");
$mail->Subject = "Blah"
$mail->MsgHTML('<html><body><img src="logo.jpg">Hello</body></html>');
$mail->AddAttachment("logo.jpg");
$mail->Send();

Using AddAttachment PHP Mailer will check your HTML for a reference to that file and automatically embed it for you.

Upvotes: 0

Gordon
Gordon

Reputation: 317119

Well, there can be only two possible answers:

  • you do not want to embed the actual image file with the eMail, then simply put an <img> element into the eMail linking to the image at the remote location, just like you would with any other HTML page. Then cross fingers and hope the client has HTML email enabled and allows display of remote images.

or

Upvotes: 1

Related Questions