我刚刚在Bloc完成了我的红宝石基础课程,我开始把头埋进轨道开发中.事情进展顺利,直到我用设计和确认电子邮件打到这个障碍.我试着谷歌搜索并环顾其他一些问题,但实际上找不到任何给我任何东西,我可以拉出来并适用于我的情况.
我在注册帐户时收到以下错误.
在#976行附近从源中提取错误
def check_auth_response(res)
unless res.success?
raise SMTPAuthenticationError, res.message
end
end
Run Code Online (Sandbox Code Playgroud)
从其他帖子我知道你可能想看到我有一个如下所示的config/initializers/setup_mail.rb文件:
if Rails.env.development?
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: 'smtp.sendgrid.net',
port: '587',
authentication: :plain,
user_name: ENV['SENDGRID_USERNAME'],
password: ENV['SENDGRID_PASSWORD'],
domain: 'heroku.com',
enable_starttls_auto: true
}
end
Run Code Online (Sandbox Code Playgroud)
这是一个application.yml文件示例:
SENDGRID_PASSWORD:
SENDGRID_USERNAME:
SECRET_KEY_BASE:
Run Code Online (Sandbox Code Playgroud)
在任何人建议之前,我的config/environments/development.rb中还有以下内容:
config.action_mailer.default_url_options = { host: 'localhost:3000'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
# Override Action Mailer's 'silent errors' in development
config.action_mailer.raise_delivery_errors = true
Run Code Online (Sandbox Code Playgroud)
如果你想看到任何其他文件让我知道,我会将它们添加到这篇文章中.