Rails Mailer:发送电子邮件到本地文件 [英] Rails Mailer: sending emails to a local file
本文介绍了Rails Mailer:发送电子邮件到本地文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法将rails 3中的邮件发送到本地文件,而不是使用SMTP服务器?我想测试电子邮件的内容,而不使用任何类型的SMTP,理想情况下只能在DEV环境中。
Is there any way to send emails in rails 3 to a local file or so, instead of using an SMTP server? I'd like to test the email's contents without using any kind of SMTP, ideally only in DEV environment.
最好的是本地SMTP或允许我检查电子邮件,检查电子邮件地址等。
The best would be a local SMTP or something that allowed me to inspect emails, check email addresses, etc.
推荐答案
您可以使用:test system delivery
You can use the :test system delivery
ActionMailer::Base.delivery_method = :test
还有一个:file delivery_method
There are also a :file delivery_method
ActionMailer::Base.delivery_method = :file
您可以定义放置所有带有file_settings的电子邮件的位置
You can define where put all email with file_settings
ActionMailer::Base.file_settings = { :location => Rails.root.join('tmp/mail') }
这篇关于Rails Mailer:发送电子邮件到本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文