简体   繁体   中英

ArgumentError in Devise::RegistrationsController#create SMTP-AUTH requested but missing user name

I have problem with sending emails from localhost. it was working on linux and now I'm trying to run my app on mac and it doesn't work already.

I have an error:

ArgumentError in Devise::RegistrationsController#create
SMTP-AUTH requested but missing user name

in config/environments/development.rb:

#Action Mailer config
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.delivery_method = :smtp
# Send email in development mode.
config.action_mailer.perform_deliveries = true

config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: "587",
domain: "mail.google.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USER_ID"],
password: ENV["GMAIL_PASSWORD"]
}

My env variables are good, I tried put my credential into code as well and it still doesn't work :/

I checked similiar topics but didn't found the solution.

What can I try?

I read:

I tried put my credential into code as well and it still doesn't work :/

But have you tried replacing your var env with your gmail id/password like this ?

#Action Mailer config
**********
user_name: "my_username",
password: "my_password"
}

Just to be sure.

Ok, solved.

  1. credentials didn't work because I havn't restarted my server (stupid laziness)
  2. my env vars didn't work because I've puted them into ~.profile but it work in ~.bash_profile, that was helpful (I use OS X Yosemite).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM