Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3: SMTP Settings for Google Apps / Heroku

Here are my smtp settings for Google Apps in setup_mail.rb.

  :address              => "smtp.gmail.com",  
  :port                 => 587,                 
  :domain               => 'mysite.co',  
  :user_name            => '[email protected]',      
  :password             => 'password',      
  :authentication       => 'plain',             
  :enable_starttls_auto => true

My development logs show in detail the e-mails being generated and sent to the right e-mail address... but they are not arriving. I can only think that there must be something wrong with the settings above. Can you see what the problem is?

Once this is solved, would I have any issue getting it to work on Heroku?


Note: the above is logging a deprecation warning:

DEPRECATION WARNING: Giving a hash to body is deprecated, please use instance va
riables instead. (called from process at C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gem
s/actionmailer-3.0.0/lib/action_mailer/old_api.rb:77)
like image 625
sscirrus Avatar asked Oct 31 '10 08:10

sscirrus


2 Answers

I think if you are using rails 3, the correct approach to setup mail would be to follow this railscasts tutorial on action mailer.

like image 164
Syamantak Avatar answered Oct 23 '22 03:10

Syamantak


in your user controller don't forget to add the .deliver

UserMailer.registration_confirmation(@user).deliver

that is what stumped me

like image 5
Pete Brumm Avatar answered Oct 23 '22 01:10

Pete Brumm