Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action mailer SMTP google apps

I tried to configure actionmailer to send via google apps with smtp.

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address              => "smtp.gmail.com",
:port                 => 587,
:domain               => "mydomain.com",
:user_name            => "username",
:password             => "password",
:authentication       => 'plain',
:enable_starttls_auto => true  }

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

However whenever gitlab tries to send an e-mail:

Sent mail to [email protected] (10ms)
Completed 500 Internal Server Error in 29ms

535-5.7.1 Username and Password not accepted

Server runs ruby 1.9.3p194. Why doesn't google apps accept the username/password?

like image 642
Jubei Avatar asked Jul 29 '12 02:07

Jubei


2 Answers

It works now, I think the problem was with the username. it needs the domain in the username. i.e. the problem was

user_name: 'username'

Whereas the correct way (at least for google apps) is

user_name : '[email protected]'
like image 182
Jubei Avatar answered Sep 22 '22 02:09

Jubei


this works for me:

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

Try setting the domain to gmail.com

like image 36
justinlyman Avatar answered Sep 23 '22 02:09

justinlyman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!