3

私はアプリを持っています、それは新しく登録されたユーザーに確認メールを送信するためにdeviseを使用します、私はdevelopment.rbファイルの下にsmtp設定を持っています

  config.action_mailer.default_url_options = { :host => 'http://localhost:3000' }
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
  :enable_starttls_auto => true,
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => "gmail.com",
  :authentication => :login,
  :user_name => "my_username@gmail.com",
  :password => "mygmail password"
    }

これは、のようなエラーで私を投げています

Net::SMTPAuthenticationError in Devise::RegistrationsController#create

535-5.7.1 Please log in with your web browser and then try again. Learn more at

これを解決する方法はありますか?

これらの設定を使用して解決しました。

 config.action_mailer.default_url_options = { :host => 'localhost:3000' }
 config.action_mailer.perform_deliveries = true
 config.action_mailer.default :charset => "utf-8"
  ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :user_name            => "my_username@gmail.com",
  :password             => 'my_gmail password',
  :authentication       => "plain",
  :enable_starttls_auto => true
  }
4

3 に答える 3

3

どのコードでもこの問題を解決することはできませんでした。しばらくしてGmailアカウントにログインしたところ、これが得られたものです。

We've detected suspicious activity on your Google Account. Please create a new password to continue using your account.

Read some tips on creating a secure password. 

したがって、この問題の解決策は、メール送信に使用するアカウントにログインし、新しいパスワードを再確認するだけです

于 2013-01-27T10:44:22.823 に答える
1

:認証 => '平野'

于 2012-05-23T11:47:36.237 に答える
0

# ActionMailer の設定

config.action_mailer.default_url_options = {:host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
# change to false to prevent email from being sent during development
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"

config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: "example.com",
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: "your_mail@gmail.com",
  password: "your_password"
}

このように development.rb ファイルを作成した後、問題が発生した場合は、development.rb ファイルで使用されている gmail アカウントにログインしてください。その後、問題は解決されます。

于 2013-06-04T09:58:20.327 に答える