Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up a Gmail Account to work with ActionMailer in Rails 3

I have a contact page form that is setup to send an email to a Gmail account. Only problem is it won't send. I believe I have narrowed the error down to my settings inside of the initializers directory.

These are my current settings for trying to setup a standard gmail account to send mail: enter image description here

Could it be that my domain setting is wrong or should I be typing in [email protected] for :user_name? This is the first time I have used ActionMailer so I don't really know what I am doing. Can somebody please help me out!? Thanks!

like image 279
ab217 Avatar asked Feb 08 '11 04:02

ab217


People also ask

How do I use SMTP in Ruby on Rails?

Go to the config folder of your emails project and open environment. rb file and add the following line at the bottom of this file. It tells ActionMailer that you want to use the SMTP server. You can also set it to be :sendmail if you are using a Unix-based operating system such as Mac OS X or Linux.

How does ActionMailer work?

Action Mailer allows you to send emails from your application using mailer classes and views. Mailers work very similarly to controllers. They inherit from ActionMailer::Base and live in app/mailers , and they have associated views that appear in app/views .


1 Answers

If you are using the development environment, change the development.rb to raise delivery errors, with config.action_mailer.raise_delivery_errors = true

Also, the problem might be that :user_name should be the entire email address ([email protected]), that's how Gmail authenticates users.

like image 58
eugen Avatar answered Oct 14 '22 09:10

eugen