一个发送HTML邮件的PHP函数
写了一个简单的发送HTML邮件的PHP函数。
函数说明:send_mail("发件人地址", "收件人地址", "邮件主题", "邮件正文");
示例:
- send_mail($from, lvtao@php100.net, "这是邮件的主题", "<html><head></head><body><p><font color=red>这是邮件正文</font></p></body></html>");
代码如下:
- <?php
- function send_mail($from, $to, $subject, $message)
- {
- if ($from == "")
- {
- $from = 吕滔 <lvtao@php100.net>;//发件人地址
- }
- $headers = MIME-Version: 1.0 . " ";
- $headers .= Content-type: text/html; charset=gb2312 . " ";
- $headers .= From: . $from . " ";
- mail($to, $subject, $message, $headers);
- }
- ?>
补充:Web开发 , php ,