我正在尝试从一个非常简单的 Rails 3.2 应用程序设置邮件。尝试过 Gmail,尝试过 SendGrid。得到同样的错误。
Net::SMTPAuthenticationError in UsersController#create
530-5.5.1 Authentication Required
这是我的环境/development.rb 部分
# Care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
# Change mail delivery to either :smtp, :sendmail, :file, :test
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "signaldesign.net",
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["gmailusername"],
password: ENV["gmailpassword"]
}
这是我的 users_controller
def create
@user = User.new(params[:user])
if @user.save
UserMailer.signup_confirmation(@user).deliver
sign_in @user
flash[:success] = "Welcome!"
redirect_to @user
else
render 'new'
end
end
我难住了。我在网上找到的任何建议都没有任何作用。