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

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

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

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

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

希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論