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

ilh*_*han -1 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);
?>
Run Code Online (Sandbox Code Playgroud)

iLa*_* ツ 5

试试这个,希望它能奏效

$headers =  "From: Website  <webmaster@example.com,dat@teddy.com> \r\n";
Run Code Online (Sandbox Code Playgroud)

或这个

$headers =  "From: WebMaster <webmaster@example.com>, Dat<dat@teddy.com> \r\n";
Run Code Online (Sandbox Code Playgroud)