亚马逊SES电子邮件传递问题

时间:2014-11-03 11:50:45

标签: ruby-on-rails email amazon-web-services amazon-ec2 amazon-ses

我有一个使用Amazon SES服务的rails应用程序向客户发送信息电子邮件。在开发环境中,此电子邮件功能正常运行。但是,当我在EC2实例中运行我的应用程序时,不再发送电子邮件。

我检查了日志,一切看起来都不错:

Rendered email_service/send_booking_request_customer_notification.html.erb (7.6ms)

Sent mail to cliente.yanpy@gmail.com (25.8ms)
Date: Mon, 03 Nov 2014 11:17:57 +0000
From: Yanpy <business@yanpy.com>
To: cliente.yanpy@gmail.com
Message-ID: <5457646572252_1be3fd803f643b45382f@ip-172-31-20-213.mail>
Subject: Nueva solicitud de reserva [MMSGORDH].
Mime-Version: 1.0
Content-Type: multipart/related;
 boundary="--==_mimepart_5457646554c90_1be3fd803f643b4536a1";
 charset=UTF-8
Content-Transfer-Encoding: 7bit


----==_mimepart_5457646554c90_1be3fd803f643b4536a1
Content-Type: multipart/alternative;
 boundary="--==_mimepart_545764656fbba_1be3fd803f643b4537bb";
 charset=UTF-8
Content-Transfer-Encoding: 7bit


----==_mimepart_545764656fbba_1be3fd803f643b4537bb
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable

[text-content]

----==_mimepart_545764656fbba_1be3fd803f643b4537bb
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
[html-content]

----==_mimepart_545764656fbba_1be3fd803f643b4537bb--

----==_mimepart_5457646554c90_1be3fd803f643b4536a1
Content-Type: image/png;
 charset=UTF-8;
 filename=logo.png
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename=logo.png
Content-ID: <545764654ea73_1be3fd803f643b4535ba@ip-172-31-20-213.mail>

iVBORw0KGgoAAAANSUhEUgAAAWAAAAB5CAYAAAAHz/urAAAACXBIWXMAAAsT
AAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3...

----==_mimepart_5457646554c90_1be3fd803f643b4536a1--

我已检查过business@yanpy.com是经过验证的发件人电子邮件地址。我甚至已经将来自SES控制台的测试电子邮件从business@yanpy.com发送到cliente.yanpy@gmail.com,然后发送和接收电子邮件。

但是,当我以编程方式发送这些电子邮件时,一切看起来都不错,但收不到电子邮件。

1 个答案:

答案 0 :(得分:0)

我修好了。我已经意识到我在Rails中缺少我的测试环境的smtp配置。

我补充说:

config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
        :address => "email-smtp.eu-west-1.amazonaws.com",
        :user_name => "************", # Your SMTP user here.
        :password => "*************", # Your SMTP password here.
        :authentication => :login,
        :enable_starttls_auto => true
    }

到我在Rails中的environment / test.rb配置文件,它工作正常。