寫了一個簡單的發送HTML郵件的PHP函數。
函數說明:send_mail("發件人地址", "收件人地址", "郵件主題", "郵件正文");
示例:send_mail($from, "info@s135.com", "這是郵件的主題", "<html><head></head><body><p><font color=red>這是郵件正文</font></p></body></html>");
代碼如下:
復制代碼代碼如下:
<?php
function send_mail($from, $to, $subject, $message)
{
if ($from == "")
{
$from = '回憶未來 <webmaster@s135.com>';//發件人地址
}
$headers = 'MIME-Version: 1.0' . "/r/n";
$headers .= 'Content-type: text/html; charset=gb2312' . "/r/n";
$headers .= 'From: ' . $from . "/r/n";
mail($to, $subject, $message, $headers);
}
?>