我正在使用SES和Django向多个收件人发送电子邮件。
第一个接收器正确接收到它,而不是其他接收器。我试过改变收件人的顺序,但总是第一个收到邮件。我使用相同的代码比另一个项目,我没有任何问题…因此,我怀疑是亚马逊的问题,但从亚马逊控制台发送确实工作正常。
当检查第一封邮件收到的电子邮件时,我可以看到它应该被发送到正确的地址(在到字段中)。
普通收到的电子邮件是这样的(我已经删除了ip和id,并用email-number@gmail.com代替了电子邮件):
Delivered-To: EMAIL-1@gmail.com
Received: by ... with SMTP id nXXX;
Wed, 10 Apr 2013 18:02:18 -0700 (PDT)
X-Received: by ... with SMTP id XXX;
Wed, 10 Apr 2013 18:02:17 -0700 (PDT)
Return-Path: <XXX-000000@amazonses.com>
Received: from a8-50.smtp-out.amazonses.com (a8-50.smtp-out.amazonses.com. [...])
by mx.google.com with ESMTP id XXX;
Wed, 10 Apr 2013 18:02:17 -0700 (PDT)
Received-SPF: pass (google.com: domain of XXX@amazonses.com designates ... as permitted sender) client-ip=...;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of XXX@amazonses.com designates ... as permitted sender) smtp.mail=XXX@amazonses.com
Return-Path: XXX@amazonses.com
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: Website Enquiry
From: noreply@mydomain.com.au
To: EMAIL1@gmail.com, EMAIL2gmail.com
Date: Thu, 11 Apr 2013 01:02:16 +0000
Message-ID: <XXX@email.amazonses.com>
Reply-To: test@gmail.com
X-SES-Outgoing: 54.240.8.50
Hello,
you have received a message from XXX:
Name: francois
Email: test@gmail.com
test 55
如前所述,如果我反向到:EMAIL2@gmail.com, EMAIL1gmail.com。EMAIL1接收到消息,而不是EMAIL2@gmail.com。
Django的代码是非常基本的,只需要这样:
self.send_email(
content=self.get_contact_email_content(contact),
subject='Website Enquiry',
to=['EMAIL1@gmail.com', 'EMAIL2@gmail.com'],
reply_to=contact.email_address
)
相同的行为在live和dev.
我笨。
找到了,我在做:
to=['EMAIL1@gmail.com, EMAIL2@gmail.com']
代替:
to=['EMAIL1@gmail.com', 'EMAIL2@gmail.com']