通过amazon-ses-mailer gem发送电子邮件时出现SSL错误

时间:2012-07-17 06:09:44

标签: ruby-on-rails ruby ruby-on-rails-3 amazon-ses

我发现了这篇帖子Using Amazon SES with Rails ActionMailer,并按照https://github.com/abronte/Amazon-SES-Mailer上的示例进行操作,但发送邮件时收到此错误

    "SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed"

配置/环境/ development.rb:

config.action_mailer.delivery_method = AmazonSes::Mailer.new(
    :secret_key => 'AKIAJ*******',
    :access_key => 'Ahs08*********'
)

发送消息:

mailer = ActionMailer::Base.delivery_method = AmazonSes::Mailer.new(
    :secret_key => 'AKI*******',
    :access_key => 'Ah***********'
  )
mailer.deliver( UserMailer.test(@this_user.email).encoded )

为什么我在这里遇到SSL错误?我尝试使用smtp与个人Gmail帐户进行另一个配置,并且发送电子邮件就好了。这是SES的问题吗?我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我认为你不再需要SES Mailer gem了。 SES过去只支持TLS包装,但截至2012年3月7日......

Amazon SES now supports STARTTLS

this SO question的答案所述。它应该像......一样简单。

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address => "email-smtp.us-east-1.amazonaws.com",
  :user_name => "..." # Your SMTP user here.
  :password => "...", # Your SMTP password here.
  :authentication => :login,
  :enable_starttls_auto => true
}
相关问题