PHP mail 发送邮件
mail
(PHP 4, PHP 5)
mail — 发送邮件
说明
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
发送一封电子邮件。
参数
to
电子邮件收件人,或收件人列表。
本字符串的格式必须符合 » RFC 2822。例如:
[email protected][email protected],
[email protected]User <
[email protected]>
User <
[email protected]>, Another User <
[email protected]>
subject
电子邮件的主题。
Caution
本项不能包含任何换行符,否则邮件可能无法正确发送。
message
所要发送的消息。
行之间必须以一个 LF( )分隔。每行不能超过 70 个字符。
Caution
(Windows 下)当 PHP 直接连接到 SMTP 服务器时,如果在一行开头发现一个句号,则会被删掉。要避免此问题,将单个句号替换成两个句号。 <?php
$text = str_replace(" .", " ..", $text);
?>
additional_headers(可选项)
String to be inserted at the end of the email header.
This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF ( ).