我正在尝试使用AWS SES从localhost发送一些电子邮件用于测试目的。
我最近在AWS控制台上更改了我的SMTP凭据,每当我尝试使用SES从本地应用发送电子邮件时,电子邮件都无法通过以下标题发送给收件人并退回给发件人:
From MAILER-DAEMON@us-west-2.amazonses.com Sun May 29 14:58:50 2016
X-Apparently-To: balteo@yahoo.fr; Sun, 29 May 2016 14:58:53 +0000
Return-Path: <>
Received-SPF: none (domain of a27-7.smtp-out.us-west-2.amazonses.com does not designate permitted sender hosts)
ZXIgdGhlIG1haWwgdG8gdGhlIGZvbGxvd2luZyByZWNpcGllbnRzOiBiYWx0
ZW9AZ21haWwuY29tIFJlcG9ydGluZy1NVEE6IGRzbjsgaHR0cDovL2EyNy0y
MC5zbXRwLW91dC51cy13ZXN0LTIuYW1hem9uc2VzLmNvbSBBY3Rpb246IGZh
aWxlZCBGaW5hbC1SZWNpcGllbnQ6IHJmYzgyMjsgYmFsdGVvQGdtYWlsLmNv
bSBEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MC01LjcuMSBVbgEwAQEBAQN0
ZXh0L3BsYWluAwMxAgNtZXNzYWdl5LXN0YXR1cwMDMQIDbWVz
c2FnZS9yZmM4MjIDAzE-
X-YMailISG: 4snxmygWLDtHybe5o15zjCZDapQTVTu4hZDcv_TW4FCtWjE7
nDyLE5rrMvq22rKmMVRtIU9m25fmKVqaIORTzaOy5PrNe8MDQhBIuhQrw6pR
dBt2Pb9jHgAmt15fpNr_6_93fWOLc.GblGJ0Kv5eRJAfQPZ3I.x1IQrHzM2U
KzhOd4LZdemwRNxyJ21xVmSVKXGdakQuJET3HOeIe.zZhfISk.d8yd.sCwYB
klU0MnNCiSh_HkXzVyOA_Yjr.DqRxR4W_LwEdE3PaFjL9cGxpxfQ1mPX5UkG
o9lVuHOkkjuXyhneDhztSnbNpe_1MDuqf8pNaG9eP.n.jRDX2hfMHGBXKekR
VtS_0qY125Hpu0ULpS2ue4tZMyDZC4nhi9aKL5_LKKyMVgRaJhZIYDw.DyyO
WgccC4BYS0AfIixDkTQHQLz9zRVVmkxYWWp7moTcCoGY.wxmK0rdFzoQmccn
1ldvx1S_f3Nr6UwZmQ.WyOHwAINKw4bA3b94UebIkr7WYWFJStRu0ZpnUr.x
gvfn7FGw4ywJ99qgLFbm8rasVkhvI2dQkCCSSvSQr67S_dd7g2k8xIixZ7qz
IR7XZxt.AUBe1gHe9nuzdci6S2gAbhjdHJyyq6WXQghrZdsBUY_Yba5oZ81f
1G0_SwvDRgw4DQ44EtCC.qcNEqiGdzjDQkowSSs1pTx3B_o.81PdjNdJshVR
b5KDfdjSYBqAFs6QEj9kpfpAMtmK9xEaiyfUXtWh5DATORu1Oy5.xOI51wG_
jLzLk1_8P1JlcvKIUpBnhn0Wy0.HKwJVeOrf3yrb.ZJtgeO7rK3xv06fucEu
AccF2zdoQPhSJpGH7IH.XnqCy6o2j37AcF6Q3wTOt90O3fzZz9YOcQK6YsfP
iEQk5uEx4sNgx92RIxXo7gXUzN_Mq9bXzq43PQs6PBfTHNbu8Zgvpg49IUcU
F9DsZpUi0681tRW7YdwhhBAbG7KKSjpuQwyK.9pv1UEj9EV5BPzagf4nH9e
0gNkuUhU6td01UREFWDZNl7Y5MQ84zP8PzolWb2iPgVggOtP1e5zxUx2m_x9
m1BPPCQyaiYafL7UIpCcczPBjIHcYbxfsla6WMEfX7qGhwVHLKAAccx0zlv.
nLL90efmyP6L_vRkllNkLGFX4SdYP6c9sgHW65rWFHvPgLAynDeJWRBemva0
iro1HgBJZfLmBeZz1SyeLreupOZxYXgmziw3jCZvzGPq9qsQkvMN_5D3gEY9
QaXjIMpoq1zXsO1L38NbrEyzeDTxKOE7aLj5tZjfeML0gw--
X-Originating-IP: [54.240.27.7]
Authentication-Results: mta1001.mail.ir2.yahoo.com from=us-west-2.amazonses.com; domainkeys=neutral (no sig); from=us-west-2.amazonses.com; dkim=neutral (no sig)
Received: from 127.0.0.1 (EHLO a27-7.smtp-out.us-west-2.amazonses.com) (54.240.27.7)
by mta1001.mail.ir2.yahoo.com with SMTPS; Sun, 29 May 2016 14:58:53 +0000
From: MAILER-DAEMON@us-west-2.amazonses.com
To: balteo@yahoo.fr
Message-ID: <01010154fd06527b-89c9140b-c9d9-49ae-af67-ff99edb17d2c-000000@us-west-2.amazonses.com>
Subject: Delivery Status Notification (Failure)
MIME-Version: 1.0
Content-Type: multipart/report;
boundary="----=_Part_1313673_1475756381.1464533930655";
report-type=delivery-status
Date: Sun, 29 May 2016 14:58:50 +0000
X-SES-Outgoing: 2016.05.29-54.240.27.7
Content-Length: 1952
有人可以帮忙吗?
修改:
使用linux和sendemail命令行实用程序,我得到了这个:
May 30 15:04:02 beta sendemail[5004]: DEBUG => Connecting to email-smtp.us-east-1.amazonaws.com:587
May 30 15:04:07 beta sendemail[5004]: DEBUG => My IP address is: 192.168.1.15
May 30 15:04:07 beta sendemail[5004]: SUCCESS => Received: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-1463334051 hUc4mRbRHsRMfbM41cQq
May 30 15:04:07 beta sendemail[5004]: INFO => Sending: EHLO beta
May 30 15:04:07 beta sendemail[5004]: SUCCESS => Received: 250-email-smtp.amazonaws.com, 250-8BITMIME, 250-SIZE 10485760, 250-STARTTLS, 250-AUTH PLAIN LOGIN, 250 Ok
May 30 15:04:07 beta sendemail[5004]: INFO => Sending: STARTTLS
May 30 15:04:07 beta sendemail[5004]: SUCCESS => Received: 220 Ready to start TLS
May 30 15:04:07 beta sendemail[5004]: DEBUG => TLS session initialized :)
May 30 15:04:07 beta sendemail[5004]: INFO => Sending: EHLO beta
May 30 15:04:07 beta sendemail[5004]: SUCCESS => Received: 250-email-smtp.amazonaws.com, 250-8BITMIME, 250-SIZE 10485760, 250-STARTTLS, 250-AUTH PLAIN LOGIN, 250 Ok
May 30 15:04:07 beta sendemail[5004]: DEBUG => SMTP-AUTH: Using LOGIN authentication method
May 30 15:04:07 beta sendemail[5004]: INFO => Sending: AUTH LOGIN
May 30 15:04:08 beta sendemail[5004]: SUCCESS => Received: 334 VXNlcm5hbWU6
May 30 15:04:08 beta sendemail[5004]: INFO => Sending: QUtJQUpMNlRZU0ZGNFdMM00zN1E=
May 30 15:04:08 beta sendemail[5004]: SUCCESS => Received: 334 UGFzc3dvcmQ6
May 30 15:04:08 beta sendemail[5004]: INFO => Sending: QW1zdkJ0WUMxaStFS2R2Z05Hcm1hVEw4T1RzTXdZTDdZRTZqNFU3QjJ5R0w=
May 30 15:04:08 beta sendemail[5004]: SUCCESS => Received: 235 Authentication successful.
May 30 15:04:08 beta sendemail[5004]: DEBUG => User authentication was successful (Method: LOGIN)
May 30 15:04:08 beta sendemail[5004]: INFO => Sending: MAIL FROM:<balteo@yahoo.fr>
May 30 15:04:08 beta sendemail[5004]: SUCCESS => Received: 250 Ok
May 30 15:04:08 beta sendemail[5004]: INFO => Sending: RCPT TO:<balteo@gmail.com>
May 30 15:04:08 beta sendemail[5004]: SUCCESS => Received: 250 Ok
May 30 15:04:08 beta sendemail[5004]: INFO => Sending: DATA
May 30 15:04:08 beta sendemail[5004]: SUCCESS => Received: 354 End data with <CR><LF>.<CR><LF>
May 30 15:04:08 beta sendemail[5004]: INFO => Sending message body
May 30 15:04:08 beta sendemail[5004]: Setting content-type: text/plain
May 30 15:04:08 beta sendemail[5004]: SUCCESS => Received: 250 Ok 0100015501c3abd4-f72c75e4-d159-48ad-aa8e-0ce1ff48493a-000000
May 30 15:04:08 beta sendemail[5004]: Email was sent successfully! From: <balteo@yahoo.fr> To: <balteo@gmail.com> Subject: [Test] Server: [email-smtp.us-east-1.amazonaws.com:587]
...但电子邮件未发送,并通过电子邮件中的以下消息返回给发件人:
An error occurred while trying to deliver the mail to the following recipients:
balteo@gmail.comOK
编辑2 :我创建了一个身份策略,如下所示:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "stmt1464615598531",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::004523851570:root"
},
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "arn:aws:ses:us-east-1:004523851570:identity/balteo@yahoo.fr"
}
]
}
我仍然无法发送电子邮件:相同的错误消息和电子邮件会发回给发件人。
编辑3 :我在退回的电子邮件正文中的内容如下:
----- Mail transféré -----
An error occurred while trying to deliver the mail to the following recipients:
balteo@gmail.comessai
答案 0 :(得分:1)
首先尝试使用SendEmail
等工具对所有基本设置进行问题排查该命令如下所示:
sendemail -v -t user@example.com -f user@example.com -u Test -m OK -s email-smtp.us-east-1.amazonaws.com:587 -xu [SMTP Username] -xp [SMTP Password]
调试选项-v将产生这种类型的输出:
May 29 11:24:18 rodm-pc sendemail[3660]: DEBUG => Connecting to email-smtp.us-east-1.amazonaws.com:587
May 29 11:24:20 rodm-pc sendemail[3660]: DEBUG => My IP address is: 192.168.1.102
May 29 11:24:20 rodm-pc sendemail[3660]: SUCCESS => Received: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-1463334051 asd
May 29 11:24:20 rodm-pc sendemail[3660]: INFO => Sending: EHLO rodm-pc
May 29 11:24:20 rodm-pc sendemail[3660]: SUCCESS => Received: 250-email-smtp.amazonaws.com, 250-8BITMIME, 250-SIZE 10485760, 250-STARTTLS, 250-AUTH PLAIN LOGIN, 250 Ok
May 29 11:24:20 rodm-pc sendemail[3660]: INFO => Sending: STARTTLS
May 29 11:24:20 rodm-pc sendemail[3660]: SUCCESS => Received: 220 Ready to start TLS
May 29 11:24:22 rodm-pc sendemail[3660]: DEBUG => TLS session initialized :)
May 29 11:24:22 rodm-pc sendemail[3660]: INFO => Sending: EHLO rodm-pc
May 29 11:24:22 rodm-pc sendemail[3660]: SUCCESS => Received: 250-email-smtp.amazonaws.com, 250-8BITMIME, 250-SIZE 10485760, 250-STARTTLS, 250-AUTH PLAIN LOGIN, 250 Ok
May 29 11:24:22 rodm-pc sendemail[3660]: DEBUG => SMTP-AUTH: Using LOGIN authentication method
May 29 11:24:22 rodm-pc sendemail[3660]: INFO => Sending: AUTH LOGIN
May 29 11:24:22 rodm-pc sendemail[3660]: SUCCESS => Received: 334 asd
May 29 11:24:22 rodm-pc sendemail[3660]: INFO => Sending: asdfasdfasdf
May 29 11:24:22 rodm-pc sendemail[3660]: SUCCESS => Received: 334 asd
May 29 11:24:22 rodm-pc sendemail[3660]: INFO => Sending: asdfasdfasfd
May 29 11:24:22 rodm-pc sendemail[3660]: SUCCESS => Received: 235 Authentication successful.
May 29 11:24:22 rodm-pc sendemail[3660]: DEBUG => User authentication was successful (Method: LOGIN)
May 29 11:24:22 rodm-pc sendemail[3660]: INFO => Sending: MAIL FROM:<user@example.com>
May 29 11:24:22 rodm-pc sendemail[3660]: SUCCESS => Received: 250 Ok
May 29 11:24:22 rodm-pc sendemail[3660]: INFO => Sending: RCPT TO:<user@example.com>
May 29 11:24:23 rodm-pc sendemail[3660]: SUCCESS => Received: 250 Ok
May 29 11:24:23 rodm-pc sendemail[3660]: INFO => Sending: DATA
May 29 11:24:23 rodm-pc sendemail[3660]: SUCCESS => Received: 354 End data with <CR><LF>.<CR><LF>
May 29 11:24:23 rodm-pc sendemail[3660]: INFO => Sending message body
May 29 11:24:23 rodm-pc sendemail[3660]: Setting content-type: text/plain
May 29 11:24:23 rodm-pc sendemail[3660]: SUCCESS => Received: 250 Ok 01000154fd54a817-33e6493f-e362-42d3-ae73-24839923c8ca-000000
May 29 11:24:23 rodm-pc sendemail[3660]: Email was sent successfully! From: <user@example.com> To: <user@example.com> Subject: [test] Server: [email-smtp.us-east-1.amazonaws.com:587]
使用选项,直到您可以发送电子邮件。然后返回并确认应用中的设置。
关于IAM策略,出于问题排查目的,请先尝试默认策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ses:SendRawEmail",
"Resource": "*"
}
]
}
答案 1 :(得分:0)
我有这个问题,经过一些研究后发现问题是我在FROM字段中使用了雅虎邮件。看来你无法从雅虎发送。我看到你发送的是*** @ yahoo.fr
将其切换为gmail解决了我的问题。