[英]Rails ActionMailer receive method does nothing
I'm following the Rails official doc about action mailer receive method and testing with the rails runner 'UserMailer.receive(STDIN.read)'
command but nothing happens . 我正在跟踪有关Action rails runner 'UserMailer.receive(STDIN.read)'
接收方法的Rails官方文档,并使用Rails运行程序 rails runner 'UserMailer.receive(STDIN.read)'
命令进行测试,但没有任何反应 。
class UserMailer < ActionMailer::Base
add_template_helper EmailHelper
default from: "xx@xxx.xxx"
def user_created(params)
@user = User.find params[0]
@creator = User.find params[1]
if @user && @creator
mail(to: @user.email, subject: "......").deliver
else
logger.info "......"
end
end
def receive(email)
puts YAML::dump email
end
end
Here's the detail about my Rails app 这是有关我的Rails应用程序的详细信息
rails@4.1.6
actionmailer@4.1.5
The UserMailer
actually sends emails but can not receive them. UserMailer
实际上发送电子邮件,但无法接收。 Any ideas? 有任何想法吗?
I think you want to refer to Action Mailer Basics Guide: http://guides.rubyonrails.org/action_mailer_basics.html#receiving-emails 我认为您想参考《 Action Mailer基础指南》: http : //guides.rubyonrails.org/action_mailer_basics.html#receiving-emails
I'm interpreting their suggestion to mean: Configure your mail server/process to "pipe into" a Rails runner script... That would account for the STDIN.read; 我将他们的建议解释为:将您的邮件服务器/进程配置为“管道化” Rails运行器脚本...这将说明STDIN.read; the contents of the mail message would be passed into the script. 邮件的内容将传递到脚本中。
HTH. HTH。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.