繁体   English   中英

Rails ActionMailer的接收方法无济于事

[英]Rails ActionMailer receive method does nothing

我正在跟踪有关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

这是有关我的Rails应用程序的详细信息

rails@4.1.6
actionmailer@4.1.5

UserMailer实际上发送电子邮件,但无法接收。 有任何想法吗?

我认为您想参考《 Action Mailer基础指南》: http : //guides.rubyonrails.org/action_mailer_basics.html#receiving-emails

我将他们的建议解释为:将您的邮件服务器/进程配置为“管道化” Rails运行器脚本...这将说明STDIN.read; 邮件的内容将传递到脚本中。

HTH。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM