ActionMailer和开发模式,它可以写入文件还是其他内容? [英] ActionMailer and development mode, can it write to a file or something?

查看:74
本文介绍了ActionMailer和开发模式,它可以写入文件还是其他内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在本地测试我的注册过程(开发模式),如何测试电子邮件的发送和呈现方式等?

I want to test my registration process locally (development mode), how can I test how emails will be sent out and rendered etc?

我不是指单元测试或集成测试,但是只是在开发我的应用程序并进入注册页面时。我希望它发送电子邮件,但不使用smtp发送到文件。

I am not referring to a unit-test or integration test, but just while developing my app and going on the register page etc. I want it to send out the emails but to a file not using smtp.

这可能吗?

我有什么选择?

推荐答案

这可以在 config / environments / *。rb 文件中进行配置。

This is configurable in the config/environments/*.rb files.

# output to tmp/mails directory
config.action_mailer.delivery_method = :file
# ... and to specify output location
# config.action_mailer.file_settings = { :location => Rails.root.join('tmp/mail') }

详细信息可以在< 配置部分 > Action Mailer基础或在 ActionMailer :: Base API

Detailed information can be found in the config section of Action Mailer Basics or on ActionMailer::Base API

Rails 4.2 :file 投放方法源 Mail :: FileDelivery源

Rails 4.2 :file delivery method source and Mail::FileDelivery source

这篇关于ActionMailer和开发模式,它可以写入文件还是其他内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆