当前位置:编程学习 > php >>

网上找到的两个PHP发送邮件的例子,很不错,贴出来给初学者参考吧(不知道是否有兄弟曾贴过),呵呵(2)

答案:Advanced Example


Here we will show the full capabilities of the PHP mail function.

PHP Code:
<?php

echo "<html><body>";

$recipient = "Kris Arndt <karn@nucleus.com>,npl@nucleus.com";
$subject = "Testing the mail function";
$message = "Hello!\n\nThis is the body of the message.\n\n";
$extra = "From: kris@phpworld.com\r\nReply-To: karn@nucleus.com\r\n";

mail ($recipient, $subject, $message, $extra);

echo "Sending mail...";
echo "</body></html>";

?>



We send an email to two people this time, by putting two email addresses in the recipient field and separating them with commas.

The fourth parameter holds extra headers for the email.  We specify who the email was from and who the recipient should reply to.  When entering multiple headers, separate them with the line feed and new line combination ('\r\n').

上一个:网上找到的两个PHP发送邮件的例子,很不错,贴出来给初学者参考吧(不知道是否有兄弟曾贴过),呵呵(1)
下一个:不会PHP,这个好象是“收发”邮件的一个程序,估计是好东西。

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,