Jump to content

Embed Image in Email Using PHP


matvespa

Recommended Posts

Hi. I am using 'tinymce' to create and send newsletter  to my customer via email. The problem i face is that when i send the newsletter, only text can be seen and the image cant be seen at all. Please advise. Here is my email code:

 

include("Mail.php"); 
include("Mail/mime.php"); 

$message = $_POST['elm2']; //the name of my tinymce textarea elm2

$text = "Text version of email"; 
$html = $message;
$file = ""; 
$crlf = "\r\n"; 
$hdrs = array( 
              "From"    => "[email protected]", 
              "Subject" => "Test mime message" 
              ); 

$mime = new Mail_mime($crlf); 

$mime->setTXTBody($text); 
$mime->addHTMLImage ($file, "image/jpeg"); 
$mime->setHTMLBody($html); 

$body = $mime->get(); 
$hdrs = $mime->headers($hdrs); 


$mail =& Mail::factory("mail"); 
$mail->send("[email protected]", $hdrs, $body); 
?>

Link to comment
https://forums.phpfreaks.com/topic/191315-embed-image-in-email-using-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.