根据Amazon's Doc's,如果我想在一个呼叫中发送多封电子邮件,可以像这样简单地添加它
$recipient_emails = ['[email protected]','[email protected]'];
但是我也希望能够发送用户名,所以我知道正确的格式是
$recipient_emails = ["[email protected] <[email protected]>"];
我很难找到任何文档,但我想我可以通过多封电子邮件发送名称
$recipient_emails = ["recipient1 <[email protected]>", "recipient2 <[email protected]>"];
在我的代码中,我试图正确构造电子邮件,但是不确定我的代码是否错误,或者无法使用上面的示例通过电子邮件发送名称。
if ($thisisanarray == 1) {
foreach ($to_email as $to_emails) {
$name = $to_emails['name'];
$username = $to_emails['username'];
$recipient_emails_arr[] = "$name <$username>";
}
$recipient_emails = implode(",",$recipient_emails_arr);
$recipient_emails = [$recipient_emails];
}
任何人都可以帮忙吗?
如果AWS API接受一组收件人,则不需要代码中的最后两行。只需尝试直接传递$recipient_emails_arr
。否则,您将创建单个字符串,而不是收件人数组。