如何使用php发送电子邮件,发件人有两封电子邮件?

时间:2012-10-11 12:11:33

标签: php email

有一个标准表明您可以从多个电子邮件地址发送。我的意思是发件人标头可以有多个电子邮件地址。

http://tools.ietf.org/html/rfc5322#section-3.6.2

我尝试了mail函数的不同组合,但都没有。

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com, dat@teddy.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>


<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" . 'From: dat@teddy.com' . "\r\n"
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

1 个答案:

答案 0 :(得分:5)

试试这个,希望它能起作用

$headers =  "From: Website  <webmaster@example.com,dat@teddy.com> \r\n";

或者

$headers =  "From: WebMaster <webmaster@example.com>, Dat<dat@teddy.com> \r\n";
相关问题