RORails
RORails

Reputation: 31

ActionMailer Rails : Not able to send emails

I have the following code in my environment/development.rb

 config.action_mailer.raise_delivery_errors = true;
 config.action_mailer.delivery_method = :smtp;
 config.action_mailer.smtp_settings = {
   :address => "smtp.gmail.com",
   :port => 587,
   :user_name => "[email protected]",
   :password => "secret",
   :authentication => :plain,
   :enable_starttls_auto => true,
   :domain => "localhost",
 }

An email is being generated by the call to the mailer model from one of my controllers. However, i am not able to send or receive any emails on gmail.

I am on ruby 1.8.7, rails 2.3.5. There are no exceptions, just that no emails are being exchanged between the actual mail servers.

Being quite new to mailer, sorry for any rookie questions.

A similar query: Actionmailer not working in rails 2.3

Thanks

Upvotes: 3

Views: 704

Answers (2)

Matteo Alessani
Matteo Alessani

Reputation: 10412

Above your code you you need to put those lines mandatory for the authentication:

require 'tlsmail'
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)

You need also the tlsmail gem.

If it doesn't work you can try removing the domain key from you settings.

Upvotes: 1

buruzaemon
buruzaemon

Reputation: 3907

Are you doing authentication with STARTTLS before sending the mail?

Upvotes: 0

Related Questions