Hi,
i want to include images in email,i write the following script which unfortunatly not working,please any one help me resloved my issue

`$to = "example@gmail.com";
$subject = "new account created";
$body = "New account has been created
<img border=’0' src=’http://www.example.com/myimages/track.php?MID=1111&SID=2222' width=’1' height=’1'>
" ;

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: admin@gmail.com";

$neww=mail($to,$subject,$body,$headers);
`

Re: how to send embed images in email using php and html 80 80

Are you sure your image src points to valid image?

Re: how to send embed images in email using php and html 80 80

yes i am sure because this is php script to creat an image there

Re: how to send embed images in email using php and html 80 80

Try using someanother live image.. example http://l.yimg.com/a/i/ww/met/yahoo_logo_in_061509.png or any other which is directly image file and not php.

Re: how to send embed images in email using php and html 80 80

dear it give me the same result,the script not able to send image there,if you have any example please show me that

Re: how to send embed images in email using php and html 80 80
<?
$to = 'myemail@gmail.com';
$subject = 'test subject';
$message = 'this is <strong>html</strong> <img src="http://l.yimg.com/a/i/ww/met/yahoo_logo_in_061509.png" > message';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
echo '->'.mail($to, $subject, $message, $headers);
?>

This worked for me. But if you are giving image as a src then that image will be come loaded from live. So if you are using gmail, it will ask something like Images are not displayed. Display images below.

But if you want image as a content in email you need to take image data and add it message rather than giving url.

I use phpmalier class. It is very easy to use.

Re: how to send embed images in email using php and html 80 80

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
this one is not working for me. gmail is not asking for ""display images bellow"". what i have to do

Re: how to send embed images in email using php and html 80 80

$Image=basename($_FILES['file']['name']);
$Image=str_replace(' ','|',$Image);
$date=date('YmdHis');
$date=str_replace('%20',' ',$date);
$Image=$date.".jpg";
$tmppath="images/".$Image;

move_uploaded_file($_FILES['file']['tmp_name'],$tmppath);

Re: how to send embed images in email using php and html 80 80
Re: how to send embed images in email using php and html 80 80

the code given above is not working

Re: how to send embed images in email using php and html 80 80

This thread is over 2 years old. I suggest you start a new thread and clearly state what code you are using and what is not working. Be very specific and detailed.

Re: how to send embed images in email using php and html 80 80

http://www.computersneaker.com/send-email-using-phpmailer/
the above tutorial link is not working.
could you share any alternate one.

Re: how to send embed images in email using php and html 80 80

Just a note, local files are not recognized when sending emails, you have to put the images on a server and then you will be able to reference them, hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.