|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
sending email with html content
Hi guys,
I am trying to use html code as content of the email i sending out by using php but why the email my friends received are all in text format ??? what should i do to make my html code works in an email... i have created a html file and want to send it out as newsletter.. what i did is copy all the html code from the file and paste it as value for $contents but this doesn't seem to work.,, please advise what i suppose to do,, is it i missed some header ?? Code:
// connect to db code..
$to = "{$row['email']}\r\n";
//$from= "From: $name < $email >\r\n";
$from= "From: testing while< myemail >\r\n";
$subject ="$subject\r\n";
if($mailtype != "html")
{
$MailText = stripslashes($MailText);
}
$contents ="$MailText";
mail($to,$subject,$contents,$from);
|
|
#2
|
|||
|
|||
|
Hi guys,
now it can shows the html page after i added the headers (after refer to complex email part from php.net).. i have another problems now.. i am wondering why when i viewed the email, the html page displayed on my mailbox looks different from the online version ??? problem i encountered : - some part of the page colors are different from the online page.,. for instance, a cell suppose to be yellow color but it displayed green in my mailbox - some of the textfield contain unwanted values such as \"submit \", \"login\" and etc.. the textfields value should be empty but how come there are values with slashes there ?? when i add stripslashes function for my content, i would not able to view the html page (only text displayed),, but if i dun add this function, i am not able to view the proper html page.. please advise what i suppose to do,, thanks. Code:
$from= "From: testing while< myemail >\r\n";
$subject ="$subject\r\n";
if($mailtype != "html")
{
$contents = stripslashes($MailText);
}
else
{
$contents ="$MailText";
$from .= "MIME-Version: 1.0\r\n";
$from .= "Content-type: text/html; charset=iso-8859-1\r\n";
}
$contents.="
============================================
Please visit http://testing.com to unsubscribe from the mailing list. Thank you.
============================================";
mail($to,$subject,$contents,$from);
if(mail)
{
echo ' email is sent to :';
echo "<br>".$row['email']."<br>";
}
}
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > sending email with html content |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|