为什么这个邮递员不发邮件?(或者对调试有什么想法?)
在my_app/config/environments/development.rb中,我有以下代码:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'my_app.com',
user_name: ENV['GMAIL_USERNAME'],
password: ENV['GMAIL_PASSWORD'],
authentication: 'plain',
enable_starttls_auto: true }然后,在我的本地计算机上,在~/..bash_profile中,我有以下代码:
export GMAIL_USERNAME='blah@my_app.com'
export GMAIL_PASSWORD='***'当我在终端中运行$ env时,我看到两个环境变量都被正确设置。
我还重新启动了rails服务器。
发布于 2013-12-25 07:17:11
你应该加上
config.action_mailer.perform_deliveries = true默认情况下,这是错误的,阻止从您的开发环境发送邮件.
发布于 2014-09-25 18:41:19
对于不使用smtp的人,除了显式地设置要执行的传递之外,将传递方法切换到sendmail还可以帮助我:
config.action_mailer.delivery_method = :sendmail发布于 2015-12-14 21:39:20
如果您在从控制台发送电子邮件时遇到问题,则必须调用邮件上的传递方法。
MyMailer.create_email.deliverhttps://stackoverflow.com/questions/20769589
复制相似问题