php 的mail() 的问题
时间:2006-04-08 来源:lucent918
想用在我租用的万网的空间上用mail()函数发送表单邮件
用 看到这个服务器空间上的sendmail_from 是 [email protected]
mail()函数的使用格式是: mail(收件人Email, 信件標題, 信件內容, 信件檔頭, 其他參數)
那在"收件人Eamil"的上,我应该填写 [email protected] ?
但我想用来接收表单邮件的mail是: [email protected] ,应该怎么办?又不能到服务器上改php.ini 中的 sendmail_from 的设置为[email protected]。
给你贴一个例子吧,发件人写在header信息里面
/* recipients */
$to = "Mary " . ", " ; // note the comma
$to .= "Kelly ";
/* subject */
$subject = "Birthday Reminders for August";
/* message */
$message = '
Birthday Reminders for August
Here are the birthdays upcoming in August!
PersonDayMonthYear
Joe3rdAugust1970
Sally17thAugust1973
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "From: Birthday Reminder \r\n";
$headers .= "Cc: [email protected]\r\n";
$headers .= "Bcc: [email protected]\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
用 看到这个服务器空间上的sendmail_from 是 [email protected]
mail()函数的使用格式是: mail(收件人Email, 信件標題, 信件內容, 信件檔頭, 其他參數)
那在"收件人Eamil"的上,我应该填写 [email protected] ?
但我想用来接收表单邮件的mail是: [email protected] ,应该怎么办?又不能到服务器上改php.ini 中的 sendmail_from 的设置为[email protected]。
给你贴一个例子吧,发件人写在header信息里面
/* recipients */
$to = "Mary " . ", " ; // note the comma
$to .= "Kelly ";
/* subject */
$subject = "Birthday Reminders for August";
/* message */
$message = '
Birthday Reminders for August
Here are the birthdays upcoming in August!
PersonDayMonthYear
Joe3rdAugust1970
Sally17thAugust1973
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "From: Birthday Reminder \r\n";
$headers .= "Cc: [email protected]\r\n";
$headers .= "Bcc: [email protected]\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
相关阅读 更多 +