ActionMailer在开发Rails 4中未发送邮件 [英] ActionMailer not sending mail in development Rails 4
本文介绍了ActionMailer在开发Rails 4中未发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么该邮件程序不发送任何邮件? (或有关调试的任何想法?)
Why is this mailer not sending any mail? (Or any ideas for debugging?)
在my_app / config / environments / development.rb中,我有以下代码:
In my_app/config/environments/development.rb I have this code:
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此代码:
Then on my local computer in ~/.bash_profile I have this code:
export GMAIL_USERNAME='blah@my_app.com'
export GMAIL_PASSWORD='***'
当我在终端中运行 $ env
时,我看到两个环境变量都已正确设置。
When I run $ env
in my terminal, I see that both environment variables are correctly set.
我还重新启动了Rails服务器。
I have also restarted my rails server.
推荐答案
您应该添加
config.action_mailer.perform_deliveries = true
默认情况下为false,以防止从您的开发环境发送邮件...
as by default this is on false, preventing mails to be sent from your development environment...
这篇关于ActionMailer在开发Rails 4中未发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文