写了一个简单的发送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);
}
?>