首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >带有多封电子邮件的迅捷邮件错误

带有多封电子邮件的迅捷邮件错误
EN

Stack Overflow用户
提问于 2019-05-21 05:18:53
回答 1查看 103关注 0票数 0

当从firebase收到多封电子邮件到php (将数据从firebase传递到HTML,然后将数据传递给PHP)时,我一直收到致命的错误消息。

致命错误:在邮箱中指定Swift_RfcComplianceException地址的异常Person1@outlook.com,Person2@gmail.com不符合RFC 2822,3.6.2

我试着从消防基地收到一封电子邮件,它运行得很好,但是多封电子邮件和我使用的任何电子邮件都会出现相同的问题。

代码语言:javascript
运行
复制
<?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);

来自数据库示例的电子邮件:

错误:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-27 09:54:16

我解决了把我从火力基地收到的电子邮件分割成数组的问题。

如下代码:

代码语言:javascript
运行
复制
$email_to = str_replace(' ','',$email_to);
$email_to = (string) $email_to;
$email_to = explode(',',$email_to);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56231535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档