php带抄送和密件抄送的邮件发送方法_php技巧
程序员文章站
2022-03-26 09:04:49
...
本文实例讲述了php带抄送和密件抄送的邮件发送方法。分享给大家供大家参考。具体分析如下:
程序中用到了php的mail函数,该函数定义如下:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
如果邮件发送成功返回True,否则返回False
Send email with CC and BCC
后端php代码,保存为sendmail.php
Send Mail Script " ; } if ( empty ( $mailsubject) ) { $mailsubject=" "; } if (($mailpriority>0) && ($mailpriority\n"; $mailheader.= "X-Sender: " . "support@yourdomain.com\n"; $mailheader.= "Return-Path: " . "support@yourdomain.com\n"; if (!empty($mailcc)) { $mailheader.= "Cc: " . $mailcc ."\n"; } if (!empty($mailbcc)) { $mailheader.= "Bcc: " . $mailbcc ."\n"; } if (empty($mailbody)) { $mailbody=" "; } $result = mail ($to, $mailsubject, $mailbody, $mailheader); echo "Mail sent to ". "$to". "
"; echo $mailsubject. "
"; echo $mailbody. "
"; echo $mailheader. "
"; if ($result) { echo "Email sent successfully!
"; }else{ echo "Email could not be sent.
"; } ?>
To CC BCC Priority Subject Message
希望本文所述对大家的php程序设计有所帮助。
推荐阅读
-
php带抄送和密件抄送的邮件发送方法
-
【PHP】发送带抄送(CC)和秘送(BCC)的邮件
-
php带抄送和密件抄送的邮件发送方法,密件邮件发送
-
php带抄送和密件抄送的邮件发送方法,密件邮件发送
-
php带抄送和密件抄送的邮件发送方法,密件邮件发送_PHP教程
-
fsockopen pfsockopen函数被禁用,SMTP发送邮件不正常的解决方法_php技巧
-
php带抄送和密件抄送的邮件发送方法_PHP教程
-
fsockopen pfsockopen函数被禁用,SMTP发送邮件不正常的解决方法_php技巧
-
php中PHPMailer发送带附件的电子邮件方法_PHP教程
-
php带抄送和密件抄送的邮件发送方法