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="xxxx@xx.com";
//$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:xxx@xx.com";
	$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
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="xxxx@xx.com";
//$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:xxx@xx.com";
	$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
Share on other sites

OK a simple test

 

<?php
$from = "tester@domain.com";
$to = "test@domain.com";
$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.