欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php發(fā)送html格式文本郵件的方法

 更新時間:2015年06月10日 14:53:13   作者:zhuzhao  
這篇文章主要介紹了php發(fā)送html格式文本郵件的方法,涉及MIME版本、字符集、內容類型等的相關設置技巧,需要的朋友可以參考下

本文實例講述了php發(fā)送html格式文本郵件的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

<?php 
$to = "simon@mailexample.com, elaine@mailexample.com"; //設置收件人 
$subject = "This is a test"; //設置E-mail主題 
//設置E-mail內容:
$message = " 
<html> 
<head> 
<title>This is a test</title> 
</head> 
<body> 
<p>Dear all,</p> 
<p>This is a test for HTML mail sending.</p> 
</body> 
</html> 
"; 
//設置郵件頭Content-type header 
$header = "MIME-Version: 1.0/r/n"; //設置MIME版本 
$header .= "Content-type: text/html; charset=iso-8859-1/r/n"; //設置內容類型和字符集 
//設置收件人、發(fā)件人信息 
$header .= "To: Simon <simon@mailexample.com>, Elaine <elaine@mailexample.com>/r/n"; //設置收件人 
$header .= "From: PHP Tester <phptester@163.com>/r/n"; //設置發(fā)件人 
$header .= "Cc: Peter@mailexample.com/r/n"; // 設置抄送 
$header .= "Bcc: David@mailexample.com/r/n"; // 設置暗抄 
echo $header; 
mail($to, $subject, $message, $header); //發(fā)送郵件 
?>

希望本文所述對大家的php程序設計有所幫助。

相關文章

最新評論