I have been struggling to send email from an EC2 instance using Yahoo mail. The following setup finally works.
- Get an Elasic IP from Amazon
- Have a domain assigned to the IP
- Request Amazon to create reverse DNS records using this form
- Make sure your IP is not blacklisted by checking the DNSBL lists
- Run the following test program to make sure that the SMTP works from your EC2 instance
require 'rubygems'
require 'action_mailer'
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:tls => true,
:address => "smtp.mail.yahoo.com",
:port => 587,
:authentication => :plain,
:user_name => "<your-email@yahoo.com>",
:password => "<your-yahoo-email-password>"
}
class Mailer < ActionMailer::Base
def do_send
subject "Test Mail"
recipients "<email-to>"
from "<your-email@yahoo.com>"
body "Test email from EC2"
end
end
Mailer.deliver_do_send
0 comments:
Post a Comment