2012-07-29 9 views
7

私はsmtpでgoogle apps経由で送信するようにactionmailerを設定しようとしました。アクションメーラーSMTP google apps

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 

しかしgitlabは、電子メールを送信しようとするたび:

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

535-5.7.1 Username and Password not accepted 

Serverはルビー1.9.3p194を実行します。 Google Appsでユーザー名とパスワードを受け入れないのはなぜですか?

+1

あなたのGmailアカウントにログインしようとすると、あなたのアプリに許可を与える必要があるかもしれません。 –

+0

@KyleC私はすでにそれを試みました。私のアプリはアクションメーラーです。 SMTPのアクセス許可を与える必要がありますか? – Jubei

+2

いいえ....これらのエラーは開発(ローカルコンピュータ)またはプロダクションで発生していますか? –

答えて

10

これはうまくいきましたが、問題はユーザー名にあったと思います。ユーザー名にドメインが必要です。

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 } 

はgmail.comにドメインを設定してみてください:(少なくともGoogleアプリのための)正しい方法は

user_name : '[email protected]' 
5

これは私の作品であるのに対し、すなわち問題が

user_name: 'username' 

ました

+0

ありがとうございます、それはgmail.comでは私にとってはうまくいますが、google appsドメインではうまくいきませんでした。ありがとうございました。 – Jubei

関連する問題