开发者

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

开发者 https://www.devze.com 2023-02-09 08:06 出处:网络
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 directo

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:

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

开发者_运维问答

Could it be that my domain setting is wrong or should I be typing in myemail@gmail.com 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!


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 (myemail@gmail.com), that's how Gmail authenticates users.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消