《PHP實戰:php發送html格式文本郵件的方法》要點:
本文介紹了PHP實戰:php發送html格式文本郵件的方法,希望對您有用。如果有疑問,可以聯系我們。
本文實例講述了php發送html格式文本郵件的辦法.分享給大家供大家參考.具體實現辦法如下:PHP編程
<?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"; //設置內容類型和字符集 //設置收件人、發件人信息 $header .= "To: Simon <simon@mailexample.com>, Elaine <elaine@mailexample.com>/r/n"; //設置收件人 $header .= "From: PHP Tester <phptester@163.com>/r/n"; //設置發件人 $header .= "Cc: Peter@mailexample.com/r/n"; // 設置抄送 $header .= "Bcc: David@mailexample.com/r/n"; // 設置暗抄 echo $header; mail($to, $subject, $message, $header); //發送郵件 ?>
希望本文所述對大家的php程序設計有所贊助.PHP編程
《PHP實戰:php發送html格式文本郵件的方法》是否對您有啟發,歡迎查看更多與《PHP實戰:php發送html格式文本郵件的方法》相關教程,學精學透。維易PHP學院為您提供精彩教程。