Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Created October 22, 2015 09:22
Show Gist options
  • Save YumaInaura/d46c4a5ba7d738291078 to your computer and use it in GitHub Desktop.
Save YumaInaura/d46c4a5ba7d738291078 to your computer and use it in GitHub Desktop.
Gmail 経由での SMTP メール送信が出来ない時の解決法 (ユーザー名とパスワードは合っているのに。。) ref: http://qiita.com/Yinaura/items/6886682a607951a71bac
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'example.com',
:user_name => '[email protected]',
:password => 'dlapwoeifkbmzksl', # Googleが発行する、12桁のアプリケーションパスワード
:authentication => :login,
:enable_starttls_auto => true
}
UserMailer.registration_confirmation.deliver_now
Net::SMTPAuthenticationError: 535-5.7.8 Username and Password not accepted. Learn more at
from /Users/yinaura/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/smtp.rb:976:in `check_auth_response'
- :user_name => '[email protected]', # gmail アドレスじゃないので使えない
+ :user_name => '[email protected]', # gmail アドレスなので使える
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment