Suresh Payankannur

Tuesday, August 16, 2011

Yahoo Mail with ActionMailer using Amazon Elastic IP

I have been struggling to send email from an EC2 instance using Yahoo mail. The following setup finally works.

  1. Get an Elasic IP from Amazon
  2. Have a domain assigned to the IP
  3. Request Amazon to create reverse DNS records using this form
  4. Make sure your IP is not blacklisted by checking the DNSBL lists
  5. Run the following test program to make sure that the SMTP works from your EC2 instance
  6. 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

Blog Archive

Scroll To Top