我应该如何通过Rails 4中的电子邮件标头传递额外的参数

时间:2014-08-12 05:35:04

标签: ruby-on-rails ruby-on-rails-4

我正在开发一个支持应用程序(https://www.cloudmailin.com),该应用程序允许客户邮寄到support@myapp.com并回复此同一个电子邮件地址。当我将包含电子邮件和客户重播的标题发送到同一个电子邮件地址时,我无法在参数中找回这些额外标题。请帮忙

参考: - http://guides.rubyonrails.org/v3.0.3/action_mailer_basics.html

看到这一点 - 2.3.1自定义标题

寄件人/ arriva_drive_mailer.rb

class ArriveDriveMailer < ActionMailer::Base
  def send_notification_to_participant(note_content, participant)
    @participant = participant
    @note_content = note_content
    headers {"X-Spam" => 'demo', "X-Special" => 'example'}
    mail(from: Settings.mail.default_url_options.support_email, to: @participant.email, subject: t('mailer.participant.subject.welcome'))
  end

重播后的参数

 Parameters: {"headers"=>{"Received"=>["by mail-we0-f171.google.com with SMTP id p10so9411954wes.30 for <4ba24d147e70d4016a69@cloudmailin.net>; Mon, 11 Aug 2014 22:27:23 -0700", "by 10.216.3.10 with HTTP; Mon, 11 Aug 2014 22:27:23 -0700"], "Date"=>"Tue, 12 Aug 2014 10:57:23 +0530", "From"=>"parthiv patel <parthiv.savani@gmail.com>", "To"=>"4ba24d147e70d4016a69@cloudmailin.net", "Message-ID"=>"<CALiaHo7D4e+qQOqVNZrZjgL=Lufv_kMx4sVCxREr-_514W6ONw@mail.gmail.com>", "In-Reply-To"=>"<CALiaHo7sdFmJvr4Gq-Ra5fQUW63_B44jArYASYTR9JZ6uVAmAw@mail.gmail.com>", "References"=>"<53e9a37d64679_c722578fd6239511@BoTree.mail> <CALiaHo7sdFmJvr4Gq-Ra5fQUW63_B44jArYASYTR9JZ6uVAmAw@mail.gmail.com>", "Subject"=>"Re: Welcome to DRIVE", "Mime-Version"=>"1.0", "Content-Type"=>"multipart/alternative; boundary=047d7bf10ade272f91050067edc8", "DKIM-Signature"=>"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=rBXuQHKQWJsAJB+P1ScZBAA7wVxRyNr9hWdjOFeiSPo=; b=CVIk/K2/jFuHPNoKdLzOu3f8Idbjwv/qt9lptSLra1vyI8PyjzgY2wBJPY0ivno2VB OwhFh+zCA0cShjEZy39vRR9DQ6YdHPCBZJroAEojMsqefFnsWI5Ykx+VB8ognGmQk5/b +Q9DxIPeqVeqekoGCfSmxvtAOf4PJFAtMH9ddGiP5p8o2tOIr5nRElBPH6bLGhryEhmr xpsIw58Z4j/2IsgngXQNYCbt3oP6DkfA9pNeMit5FvCUm4xFopCGJAGEYWyCifWZ4NLR oiMLjUwAvGF5r5Ua+evDPwOluNMXIPsrPKDw8qyjPpNUqVUr/MoLegqXVWK+1wEML4FS 6xdw==", "X-Received"=>"by 10.194.110.7 with SMTP id hw7mr2645299wjb.38.1407821243951; Mon, 11 Aug 2014 22:27:23 -0700 (PDT)"}, "envelope"=>{"to"=>"4ba24d147e70d4016a69@cloudmailin.net", "recipients"=>["4ba24d147e70d4016a69@cloudmailin.net"], "from"=>"parthiv.savani@gmail.com", "helo_domain"=>"mail-we0-f171.google.com", "remote_ip"=>"74.125.82.171", "spf"=>{"result"=>"neutral", "domain"=>"gmail.com"}}, "plain"=>"Dsdsdsd sdsssssssssssss ds\n\n\nOn Tue, Aug 12, 2014 at 10:51 AM, parthiv patel <parthiv.savani@gmail.com>\nwrote:\n\n> dfsdf sdf sdf sdf df dfd f dfd fdf\n>\n>\n> On Tue, Aug 12, 2014 at 10:47 AM, <demo4582@gmail.com> wrote:\n>\n>>  Dear Jignesh\n>>\n>> Following are the contents of the note you have been tagged in:\n>>\n>> dddddddddddddddd\n>>\n>>  Kind Regards\n>>\n>> The DRIVE Programme Team\n>>\n>\n>\n", "html"=>"<div dir=\"ltr\">Dsdsdsd sdsssssssssssss ds<br></div><div class=\"gmail_extra\"><br><br><div class=\"gmail_quote\">On Tue, Aug 12, 2014 at 10:51 AM, parthiv patel <span dir=\"ltr\">&lt;<a href=\"mailto:parthiv.savani@gmail.com\" target=\"_blank\">parthiv.savani@gmail.com</a>&gt;</span> wrote:<br>\n<blockquote class=\"gmail_quote\" style=\"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex\"><div dir=\"ltr\">dfsdf sdf sdf sdf df dfd f dfd fdf<br></div><div class=\"HOEnZb\"><div class=\"h5\"><div class=\"gmail_extra\">\n<br><br><div class=\"gmail_quote\">On Tue, Aug 12, 2014 at 10:47 AM,  <span dir=\"ltr\">&lt;<a href=\"mailto:demo4582@gmail.com\" target=\"_blank\">demo4582@gmail.com</a>&gt;</span> wrote:<br>\n<blockquote class=\"gmail_quote\" style=\"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex\"><u></u>\n\n  \n    \n  \n  <div>\n    <h3>Dear Jignesh</h3>\n    <input name=\"notification_tyle\" value=\"notes\" type=\"hidden\">\n    <p>\n      Following are the contents of the note you have been tagged in:\n    </p>\n    <p>\n      dddddddddddddddd\n    </p>\n    <br>\n    <p>\n      Kind Regards\n    </p>\n    <p>\n      The DRIVE Programme Team\n    </p>\n  </div>\n\n</blockquote></div><br></div>\n</div></div></blockquote></div><br></div>\n", "reply_plain"=>"Dsdsdsd sdsssssssssssss ds", "attachments"=>nil, "participant_attachment"=>{}}

0 个答案:

没有答案