<title>Send email with CC and BCC</title>
2. [代码]sendemailWithCC_BCC.php 跳至
<title>Mail Sent</title>
<?php
$message= " " ;
if (empty ( $mailtoname) || empty ( $mailtomail) ) {
die ( "Recipient is blank! ") ;
}else{
$to = $mailtoname . " <" . $mailtomail . ">" ;
}
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 "<center>
<b>Mail sent to ". "$to". "<br>";
echo $mailsubject. "<br>";
echo $mailbody. "<br>";
echo $mailheader. "<br>";
if ($result) {
echo "</b><p><b>Email sent successfully!</b></p>";
}else{
echo "<p><b>Email could not be sent. </b></p>";
}
?>
<p>
</p>
<table>
<tr>
<td><p><b>To</b></p></td>
<td><b><?php echo $mailtoname . " [". $mailtomail . " ]";?></b></td>
</tr>
<tr>
<td><p><b>CC</b></p></td>
<td><b><?php echo $mailcc;?></b></td>
</tr>
<tr>
<td><p><b>BCC</b></p></td>
<td><b><?php echo $mailbcc; ?></b></td>
</tr>
<tr>
<td><p><b>Priority</b></p></td>
<td><b><?php echo $mailpriority;?></b></td>
</tr>
<tr>
<td><p><b>Subject </b></p></td>
<td><b><?php echo $mailsubject;?></b></td>
</tr>
<tr>
<td><p><b>Message</b></p></td>
<td><b><?php echo $mailbody;?></b></td>
</tr>
</table>
</center>
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










