当从firebase收到多封电子邮件到php (将数据从firebase传递到HTML,然后将数据传递给PHP)时,我一直收到致命的错误消息。
致命错误:在邮箱中指定Swift_RfcComplianceException地址的异常Person1@outlook.com,Person2@gmail.com不符合RFC 2822,3.6.2
我试着从消防基地收到一封电子邮件,它运行得很好,但是多封电子邮件和我使用的任何电子邮件都会出现相同的问题。
<?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);
来自数据库示例的电子邮件:
错误:
发布于 2019-05-27 09:54:16
我解决了把我从火力基地收到的电子邮件分割成数组的问题。
如下代码:
$email_to = str_replace(' ','',$email_to);
$email_to = (string) $email_to;
$email_to = explode(',',$email_to);
https://stackoverflow.com/questions/56231535
复制相似问题