這篇文章主要介紹了php如何實(shí)現(xiàn)帶抄送和密件抄送的郵件發(fā)送,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
創(chuàng)新互聯(lián)專(zhuān)注于企業(yè)成都全網(wǎng)營(yíng)銷(xiāo)、網(wǎng)站重做改版、鑲黃網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、html5、商城系統(tǒng)網(wǎng)站開(kāi)發(fā)、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)公司、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性?xún)r(jià)比高,為鑲黃等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。具體分析如下:
程序中用到了php的mail函數(shù),該函數(shù)定義如下:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
如果郵件發(fā)送成功返回True,否則返回False
Send email with CC and BCC
后端php代碼,保存為sendmail.php
Send Mail Script " ; } if ( empty ( $mailsubject) ) { $mailsubject=" "; } if (($mailpriority>0) && ($mailpriority<6)) { $mailheader = "X-Priority: ". $mailpriority ."\n"; } $mailheader.= "From: " . "Sales Team\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
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“php如何實(shí)現(xiàn)帶抄送和密件抄送的郵件發(fā)送”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!