【PHP】发送带抄送(CC)和秘送(BCC)的邮件
跳至
<HTML> <HEAD> <TITLE>Send email with CC and BCC</TITLE> </HEAD> <BODY> <FORM action="sendemailWithCC_BCC.php" method=post name=form1> <TABLE> <TBODY> <TR> <TD> <DIV align=right><b>To</b></DIV></TD> <TD> <p>Name <INPUT name=mailtoname size=35><BR>E-mail <INPUT name=mailtomail size=35></p></TD></TR> <TR> <TD> <DIV align=right><b>CC</b></DIV></TD> <TD><INPUT name=mailcc size=35> </TD></TR> <TR> <TD> <DIV align=right><b>BCC</b></DIV></TD> <TD><INPUT name=mailbcc size=35> </TD></TR> <TR> <TD> <DIV align=right><b>Priority</b></DIV></TD> <TD><SELECT name=mailpriority> <OPTION value=1>Highest</OPTION> <OPTION value=2>High</OPTION> <OPTION selected value=3>Normal</OPTION> <OPTION value=4>Low</OPTION> <OPTION value=5>Lowest</OPTION> </SELECT> </TD></TR> <TR> <TD><DIV align=right><b>Subject</b></DIV></TD> <TD><INPUT name=mailsubject size=35></TD></TR> <TR> <TD> <DIV align=right><b>Message</b> </DIV></TD> <TD><TEXTAREA cols=50 name=mailbody rows=7></TEXTAREA> </TD></TR> <TR> <TD colSpan=2> <DIV align=center><INPUT name=Submit type=submit value=Submit></DIV> </TD> </TR> </TBODY> </TABLE> </FORM> </BODY> </HTML>
Copy after login
2. [代码]sendemailWithCC_BCC.php 跳至
<html> <head> <title>Mail Sent</title> </head> <body> <?php $message= " " ; if (empty ( $mailtoname) || empty ( $mailtomail) ) { die ( "Recipient is blank! ") ; }else{ $to = $mailtoname . " <" . $mailtomail . ">" ; } if ( empty ( $mailsubject) ) { $mailsubject=" "; } if (($mailpriority>0) && ($mailpriority<6)) { $mailheader = "X-Priority: ". $mailpriority ."\n"; } $mailheader.= "From: " . "Sales Team <sales@yourdomain.com>\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 "<center><b>Mail sent to ". "$to". "<br>"; echo $mailsubject. "<br>"; echo $mailbody. "<br>"; echo $mailheader. "<br>"; if ($result) { echo "<p><b>Email sent successfully!</b></p>"; }else{ echo "<p><b>Email could not be sent. </b></p>"; } ?> <p align="center"> <table><tr><td width="66"><p align="right"><b>To</b></p></td> <td width="308"><b><?php echo $mailtoname . " [". $mailtomail . " ]";?></b></td></tr> <tr><td width="66"><p align="right"><b>CC</b></p></td> <td width="308"><b><?php echo $mailcc;?></b></td></tr> <tr><td width="66"><p align="right"><b>BCC</b></p></td> <td width="308"><b><?php echo $mailbcc; ?></b></td></tr> <tr><td width="66"><p align="right"><b>Priority</b></p></td> <td width="308"><b><?php echo $mailpriority;?></b></td></tr> <tr><td width="66"><p align="right"><b>Subject </b></p></td> <td width="308"><b><?php echo $mailsubject;?></b></td></tr> <tr><td width="66"><p align="right"><b>Message</b></p></td> <td width="308"><b><?php echo $mailbody;?></b></td></tr> </table> </p> </body> </html>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Save File Location: Where Is It & How to Protect It?
3 weeks ago
By DDD

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
