php send html email
内容均来自国外网站,还是外国的人研究的比较的彻底
下面一段简单的发送html email的php代码
//change this to your email.
$to = "m@maaking.com";
$from = "m2@maaking.com";
$subject = "Hello! This is HTML email";
//begin of HTML message
$message = <<
Looool!!! I am reciving HTML email......
Thanks Mohammed!
http://www.maaking.com/">* maaking.com
*** Now you Can send HTML Email
Regards
MOhammed Ahmed - Palestine
EOF;
//end of message
$headers = "From: $fromrn";
$headers .= "Content-type: text/htmlrn";
//options to send to cc+bcc
//$headers .= "Cc: [email]maa@p-i-s.cXom[/email]";
//$headers .= "Bcc: [email]email@maaking.cXom[/email]";
// now lets send the email.
mail($to, $subject, $message, $headers);
echo "Message has been sent....!";
?>
下面的使用MIME格式发送
//change this to your email.
$to = "m@maaking.com";
$from = "m2@maaking.com";
$subject = "Hello! This is HTML email";
//begin of HTML message
$message = "
Looool!!! I am reciving HTML email......
Thanks Mohammed!
http://www.maaking.com/">* maaking.com
*** Now you Can send HTML Email
Regards
MOhammed Ahmed - Palestine
";
//end of message
// To send the HTML mail we need to set the Content-type header.
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$headers .= "From: $fromrn";
//options to send to cc+bcc
//$headers .= "Cc: [email]maa@p-i-s.cXom[/email]";
//$headers .= "Bcc: [email]email@maaking.cXom[/email]";
// now lets send the email.
mail($to, $subject, $message, $headers);
echo "Message has been sent....!";
?>
另外有人推荐这个 http://phpmailer.sourceforge.net. 库,他们说这个很好, 我现在正在看,我用的pear的Mail,感觉功能上稍微差些
简单的说一下phpmail的东西:
tutorial http://phpmailer.sourceforge.net./tutorial.html
官方网站:http://phpmailer.sourceforge.net
好了, 我去测试了
http://www.phpfreaks.com/tutorials/130/0.php 一个超强的教程
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/640706/viewspace-1017951/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/640706/viewspace-1017951/