PHP Mail()表单上的Cc Sender

时间:2016-06-10 07:07:46

标签: php phpmailer

将我的网络表单副本发回给发件人时遇到了麻烦。

$recipient = "myemail@myserver.com";
$subject = "Contact Form"; 
$mailheader = "From: $email \r\n";
$mailheader .= "Cc: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) 

2 个答案:

答案 0 :(得分:0)

不要使用\ n \ r,只需输入电子邮件即可。 不要使用$ mailheader。改为使用:

    $mail->From      = "a@domain.com";
    $mail->FromName  = "name of a";
    $mail->Subject   = "subject mail";
    $mail->Body      = "body mail";
    $mail->AddReplyTo("name1", "name1@something.com");
    $mail->AddAddress("name2", "name2@something.com");
    $mail->AddCC("name3", "name3@something.com");
    $mail->AddBCC("name4", "name4@something.com");

答案 1 :(得分:0)

$headers = "MIME-Version: 1.0\n";
$headers .= "From: ".$agent." <".$email.">\n";
$headers .= "cc: ".$email."\n";
$headers .= "Reply-To: Name <info@domain.com>\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: My mailer";

这给了我正确的标题,这似乎是为什么它不会CC的f,现在在gmail中显示正确的CC但我似乎是战斗的是Outlook或hotmail地址阻止它,因为我使用的是用于CC电子邮件的@hotmail。