php image display without download in mail
hi i want t开发者_Go百科o 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.
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
- you dont want to reference the file from a remote server, but embed it with the eMail. In that case, refer to How To Embed Images in HTML EMail or Attaching an image to an email
If your using PHP Mailer...
$mail = new PHPMailer();
$mail->SetFrom("blah@blah.com");
$mail->AddAddress("blah@blah.com");
$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.
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 !!!!! ;)
精彩评论