从 firebase 到 php 接收多封电子邮件时,我不断收到致命错误消息(将数据从 firebase 传递到 HTML,然后将 html 传递到 PHP)
致命错误:未捕获的异常 'Swift_RfcComplianceException' 带有消息“给定邮箱中的地址 [[email protected],[email protected]] 不符合 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('[email protected]' => '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);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句