Jump to content

[SOLVED] HTML Email !


d.shankar

Recommended Posts

Hi all.

 

I got this email script and it really irritates me a lot.

 

I need this email to be sent in html format.

When opened it should display the image and other formattings.

But nothing is working it seems.

 

I have tried this mail by sending to my gmail and it shows the image but i am not able to see the image in any other email accounts.. say yahoo,hotmail,webmail...etc

 

 

Here is the php email script

 

<?php


$to="[email protected]";
$subject="testing";
$message="<img src='http://l.yimg.com/t/img/new_in_fp_logo.gif'><br>This is a mail from yahoo india<br>";

$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 
$headers .= "\nMIME-Version: 1.0\n" . 
            "Content-Type: multipart/mixed;\n" . 
            " boundary=\"{$mime_boundary}\""; 
            
$headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n"; 
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";  
    	 
$message .= "This is a multi-part message in MIME format.\n\n" . 
                "--{$mime_boundary}\n" . 
                "Content-Type:text/html; charset=\"iso-8859-1\"\n" . 
               "Content-Transfer-Encoding: 7bit\n\n" . 
			$message . "\n\n"; 

mail($to,$subject,$message,$headers);

?>

 

Can someone help me out ?

Link to comment
https://forums.phpfreaks.com/topic/117293-solved-html-email/
Share on other sites

I am sorry to say that it isnt working

 

Here is the code... :(

 

<?php
ini_set("sendmail_from", "The Yahoo Team <[email protected]>");

$to="[email protected]";
$subject="testing1";
$message="<img src='http://l.yimg.com/t/img/new_in_fp_logo.gif'><br>This is a mail from yahoo india<br>";

$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 
$headers .= "\nMIME-Version: 1.0\n" . 
            "Content-Type:text/html; charset=\"iso-8859-1\"\n" . 
            " boundary=\"{$mime_boundary}\""; 

mail($to,$subject,$message,$headers);

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/117293-solved-html-email/#findComment-603375
Share on other sites

I have shortened down the code... it still works from my localhost , but it does not work in from my live server.

 

<?php
ini_set("sendmail_from", "The Yahoo Team <[email protected]>");
$to="[email protected]";
$subject="testing1";
$message="<img src='http://l.yimg.com/t/img/new_in_fp_logo.gif'><br>This is a mail from yahoo india<br>";
$headers .= "\nMIME-Version: 1.0\n"."Content-Type:text/html; charset=\"iso-8859-1\"\n"; 
mail($to,$subject,$message,$headers);
?>

 

 

Please somebody help  :'(

Link to comment
https://forums.phpfreaks.com/topic/117293-solved-html-email/#findComment-605912
Share on other sites

Try this:

<?php
error_reporting(E_ALL);
ini_set("sendmail_from", "The Yahoo Team <[email protected]>");

$to = "[email protected]";
$subject = "testing1";
$message = "<img src='http://l.yimg.com/t/img/new_in_fp_logo.gif' /><br />This is a mail from yahoo india<br />";

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

if(mail($to,$subject,$message,$headers)){
//It was sent!
echo "Mail has been sent!";
}else{
//Failed to send mail...
echo "Mail was not sent!";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/117293-solved-html-email/#findComment-605930
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.