多封电子邮件的 swiftmailer 电子邮件错误
swiftmailer email error with multiple emails
从 firebase 向 php 发送多封电子邮件时,我不断收到致命错误消息(将数据从 firebase 传递到 HTML,然后传递到 html 到 PHP)
Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [Person1@outlook.com,Person2@gmail.com] does not comply with RFC 2822, 3.6.2
我尝试从 firebase 获取一封电子邮件并且它工作得很好,但是我使用的任何电子邮件地址的多封电子邮件都出现了同样的问题
<?php
require '/Vendor/Mail/lib/swift_required.php';
// validation expected data exists if required later
if (!isset($_POST['agent_e']) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$email_to = $_POST['agent_e']; // required
$headers .= "MIME-Version: 1.0\r\n";
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('')
->setSubject($subject)
->setFrom(array('mailer@outlook.com' => 'mailer'))
->setTo(array($email_to))
->setBody('<html>' .
' <body>' .
' ' . // Embed the file
$messageBody .
' ' .
' </body>' .
'</html>',
'text/html' // Mark the content-type as HTML
);
// Send the message
$result = $mailer->send($message);
来自数据库示例的电子邮件:
错误:
我解决了将我从 firebase 收到的电子邮件拆分为数组的问题
如下代码:
$email_to = str_replace(' ','',$email_to);
$email_to = (string) $email_to;
$email_to = explode(',',$email_to);
从 firebase 向 php 发送多封电子邮件时,我不断收到致命错误消息(将数据从 firebase 传递到 HTML,然后传递到 html 到 PHP)
Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [Person1@outlook.com,Person2@gmail.com] does not comply with RFC 2822, 3.6.2
我尝试从 firebase 获取一封电子邮件并且它工作得很好,但是我使用的任何电子邮件地址的多封电子邮件都出现了同样的问题
<?php
require '/Vendor/Mail/lib/swift_required.php';
// validation expected data exists if required later
if (!isset($_POST['agent_e']) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$email_to = $_POST['agent_e']; // required
$headers .= "MIME-Version: 1.0\r\n";
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('')
->setSubject($subject)
->setFrom(array('mailer@outlook.com' => 'mailer'))
->setTo(array($email_to))
->setBody('<html>' .
' <body>' .
' ' . // Embed the file
$messageBody .
' ' .
' </body>' .
'</html>',
'text/html' // Mark the content-type as HTML
);
// Send the message
$result = $mailer->send($message);
来自数据库示例的电子邮件:
错误:
我解决了将我从 firebase 收到的电子邮件拆分为数组的问题
如下代码:
$email_to = str_replace(' ','',$email_to);
$email_to = (string) $email_to;
$email_to = explode(',',$email_to);