在将一系列电子邮件地址传递给AWS SES电子邮件收件人时遇到问题。我有一个MySql查询,该查询生成电子邮件地址数组$emails_array_from_query
:
for ($i=0; $i <$numrows; $i++) {
$stmt->fetch();
array_push($emails_array_from_query, $emailAddress);
};
我需要将此数组传递到SES客户端。 AWS需要以下格式:
$recipient_emails = ['recipient1@example.com','recipient2@example.com'];
我尝试implode
和json_encode
从MySQL查询中收到的数组,但是它们都不起作用,而且我不确定还有什么其他用途。这是我尝试过的:
$recipient_emails_to_pass = "'" . implode("','",$emails_array_from_query) . "'";
然后我通过这种方式:
$recipient_emails = [$recipient_emails_to_pass;]
我也尝试过这种方法:
$recipient_emails_to_pass = json_encode($emails_array_from_query);
$recipient_emails = [$recipient_emails_to_pass;]
这些都不起作用。任何帮助将不胜感激!