尽管有许多相同的问题,但没有一个解决方案对我有用。仅当只有一个收件人时才会发送邮件,否则会在下面生成错误。另外,我只发送内部电子邮件,没有外部电子邮件。
任何的想法?
代码:
$to = 'one@example.com, two@example.com, three@example.com';
$transport = Swift_SmtpTransport::newInstance('192.168.whatever', 25);
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Test')
->setFrom(array('myself@example.com'))
->setTo(array($to))
->setBody('html content goes here', 'text/html');
$result = $mailer->send($message);
echo $result;
错误:
Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [one@example.com, two@example.com, three@example.com] does not comply with RFC 2822, 3.6.2.' in C:\wamp\www\ssl\swift_emailer\lib\classes\Swift\Mime\Headers\MailboxHeader.php:308 Stack trace: #0 C:\wamp\www\ssl\swift_emailer\lib\classes\Swift\Mime\Headers\MailboxHeader.php(238): Swift_Mime_Headers_MailboxHeader->_assertValidAddress('lukas.borecki@l...') #1 C:\wamp\www\ssl\swift_emailer\lib\classes\Swift\Mime\Headers\MailboxHeader.php(96): Swift_Mime_Headers_MailboxHeader->normalizeMailboxes(Array) #2 C:\wamp\www\ssl\swift_emailer\lib\classes\Swift\Mime\Headers\MailboxHeader.php(60): Swift_Mime_Headers_MailboxHeader->setNameAddresses(Array) #3 C:\wamp\www\ssl\swift_emailer\lib\classes\Swift\Mime\SimpleHeaderFactory.php(60): Swift_Mime_Headers_MailboxHeader->setFieldBodyModel(Array) #4 C:\wamp\www\ssl\swift_emailer\lib\classes\Swift\Mime\SimpleHeaderSet.php(75): Swift_Mime_SimpleHead in C:\wamp\www\ssl\swift_emailer\lib\classes\Swift\Mime\Headers\MailboxHeader.php on line 308
看着:
Swift 网站 swift 邮件程序错误 'Swift_RfcComplianceException'.... Google 论坛 等等。