ab217
ab217

Reputation: 17160

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!

Upvotes: 40

Views: 25041

Answers (3)

user3468739
user3468739

Reputation: 21

You also need to specify :from. I found that if you deliver your email with .deliver you do not get an exception for the errors. Try .deliver! instead. With .deliver! you get details about what is wrong.

Upvotes: 0

RonanOD
RonanOD

Reputation: 885

domain does not necessarily have to be "gmail.com". You can put your own domain here is you wish.

Upvotes: 0

eugen
eugen

Reputation: 9226

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.

Upvotes: 43

Related Questions