Jump to content

Mail with Image


jeeva

Recommended Posts

thanks MadTechie,

 

actually i dont want to attach the file i want send the mail with company logo...that is wt i am trying....

 

here is my code

<?php
$subject="hi";
$message="<table border=1><tr><td>hi this is test mail</td></tr></table>";
$to="[email protected]";
//$from=str_replace(" ","",$fromAdd);
$from="jeeva";
//ini set for mail
	ini_set("SMTP",$server);
	//ini_set("sendmail_from",$from);

//set the html header
	$femail = "From: $from<$to>";
	$cc="Cc:[email protected]";
	$remail = "Reply-To: $from<$to>";
	$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail=mail($to,$subject,$message,$headers);
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/73462-mail-with-image/#findComment-370593
Share on other sites

Assuming, the table works

i don't see any image link..

try this, update the http://domain.com/test/jpg

 

<?php
$subject="hi";
$message="<table border=1><tr><td>hi this is test mail</td></tr></table>
<img scr=\"http://domain.com/test/jpg\">
";
$to="[email protected]";
//$from=str_replace(" ","",$fromAdd);
$from="jeeva";
//ini set for mail
	ini_set("SMTP",$server);
	//ini_set("sendmail_from",$from);

//set the html header
	$femail = "From: $from<$to>";
	$cc="Cc:[email protected]";
	$remail = "Reply-To: $from<$to>";
	$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail=mail($to,$subject,$message,$headers);
?>

 

 

 

EDIT: oops. forgot to escaped the quote

Link to comment
https://forums.phpfreaks.com/topic/73462-mail-with-image/#findComment-370608
Share on other sites

OK a simple test

 

<?php
$from = "[email protected]";
$to = "[email protected]";
$subject = "Testing";
$body = "This is a <b>test</b> <img scr=\"http://domain.com/test.jpg\">";
$plainbody = strip_tags($body);


$headers = "From: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid(md5(time));
$headers .= "Content-Type: multipart/alternative" .
   "; boundary = $boundary\r\n\r\n";
$headers .= "This is a MIME encoded message.\r\n\r\n";

//plain text version of message
$headers .= "--$boundary\r\n" .
   "Content-Type: text/plain; charset=ISO-8859-1\r\n" .
   "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode($plainbody));

//HTML version of message
$headers .= "--$boundary\r\n" .
   "Content-Type: text/html; charset=ISO-8859-1\r\n" .
   "Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode($body));

//send message
mail($to, $subject, "", $headers);
?> 

Link to comment
https://forums.phpfreaks.com/topic/73462-mail-with-image/#findComment-371569
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.