ActionMailer SMTP settings in rails

1. Add following line to rails environment file
ActionMailer::Base.delivery_method = :smtp
2. Include your email authentication
Create a ruby file called smtp_settings under config/initializers directory# config/initializers/smtp_settings.rbActionMailer::Base.smtp_settings = { :address => "", :port => 587, :authentication => :plain, :enable_starttls_auto => true, :user_name => "", :password => "_my_gmail_password_"}noTE** Keep starttls_auto always true
3. Create sample mailer in order to ensure that your settings are correct
Create a sample mailer
class EmailMailer < ActionMailer::Base def test_email from '' to '' subject "This is test email" message "It should get delivered to recipient inbox" endend4. Test your configuration

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.