簡體   English   中英

使用亞馬遜 ses php SDK 發送多封電子郵件

[英]sending multiple emails with amazon ses php SDK

根據亞馬遜的文檔,如果我想在一個電話中發送多封電子郵件,我可以像這樣簡單地添加它

$recipient_emails = ['recipient1@example.com','recipient2@example.com'];

但我也希望能夠發送用戶名,所以我知道正確的格式是

$recipient_emails = ["recipient1@example.com <recipient2@example.com>"];

我很難找到任何文檔,但我假設我可以這樣做以通過多封電子郵件發送名稱

$recipient_emails = ["recipient1 <recipient2@example.com>", "recipient2 <recipient2@example.com>"];

在我的代碼中,我正在嘗試正確構建電子郵件,但我不確定我的代碼是否錯誤,或者我無法使用上面的示例發送帶有電子郵件的名稱。

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即可。 否則,您將創建一個字符串,而不是收件人數組。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM