[英]sending multiple emails with amazon ses php SDK
According to Amazon's Doc's if I want to send multiple emails in one call I can add it simply like this根据亚马逊的文档,如果我想在一个电话中发送多封电子邮件,我可以像这样简单地添加它
$recipient_emails = ['recipient1@example.com','recipient2@example.com'];
but I want to be able to send the name of the user as well so I know that the correct format for this is但我也希望能够发送用户名,所以我知道正确的格式是
$recipient_emails = ["recipient1@example.com <recipient2@example.com>"];
I am having a hard time finding any documentation but I am assuming I can do this to send the name with multiple emails我很难找到任何文档,但我假设我可以这样做以通过多封电子邮件发送名称
$recipient_emails = ["recipient1 <recipient2@example.com>", "recipient2 <recipient2@example.com>"];
In my code I am trying to construct the emails properly but I am not sure if my code is wrong, or I can not send the name with the emails with the example right above.在我的代码中,我正在尝试正确构建电子邮件,但我不确定我的代码是否错误,或者我无法使用上面的示例发送带有电子邮件的名称。
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];
}
Can anyone help?任何人都可以帮忙吗?
If AWS API accepts array of recipients, you don't need the last two lines from your code.如果 AWS API 接受收件人数组,则您不需要代码中的最后两行。 Just try to pass
$recipient_emails_arr
directly.只需尝试直接传递
$recipient_emails_arr
即可。 Otherwise you're creating a single string, rather than array of recipients.否则,您将创建一个字符串,而不是收件人数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.