evendis / mandrill-rails

Webhook processing and event decoration to make using Mandrill with Rails just that much easier
MIT License
288 stars 36 forks source link

undefined method `from_email' for #<Mandrill::WebHook::EventDecorator:0x00000007627738> #8

Closed soulnafein closed 10 years ago

soulnafein commented 10 years ago

Exception backtrace

/app/vendor/bundle/ruby/1.9.1/gems/mandrill-rails-1.0.0/lib/mandrill/web_hook/processor.rb:25:in `block in run!'
/app/vendor/bundle/ruby/1.9.1/gems/mandrill-rails-1.0.0/lib/mandrill/web_hook/processor.rb:21:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/mandrill-rails-1.0.0/lib/mandrill/web_hook/processor.rb:21:in `run!'
/app/vendor/bundle/ruby/1.9.1/gems/mandrill-rails-1.0.0/lib/mandrill-rails/web_hook_processor.rb:79:in `create'

Webhook Payload (redacted)

  {
    "event": "inbound",
    "ts": 1385559214,
    "msg": {
      "raw_msg": "Received: from xxxx.xxxx.xxxxxxx.net (mail.xxxxx.co.uk [99.99.99.99])\n\tby ip-99-99-99-99 (Postfix) with ESMTP id 122333333\n\tfor <offer-88206@inbound.xxxxx.co.uk>; Wed, 27 Nov 2013 13:33:32 +0000 (UTC)\nReceived: from xxxx.xxxx.xxxx.net (localhost.localdomain [127.0.0.1])\n\tby localhost (Email Security Appliance) with SMTP id F3EE6101E628_295E809B\n\tfor <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 12:39:37 +0000 (GMT)\nReceived: from xxxx.xxxx.co.uk (unknown [53.247.144.158])\n\tby xxxx.xxxx.xxxx.net (Sophos Email Appliance) with ESMTP id E041E10CAFD0_295E809F\n\tfor <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 12:39:37 +0000 (GMT)\nImportance: Normal\nX-Priority: 3 (Normal)\nIn-Reply-To: <5295e0a55ab73_29e0ebc103b1@4830b3e0-2675-41d3-8df8-dc78e0a45544.mail>\nReferences: <5295e0a55ab73_29e0ebc103b1@4830b3e0-2675-41d3-8df8-dc78e0a45544.mail>\nSubject: Re: Leeroy, you have a question from Toni about offer 88206\nMIME-Version: 1.0\nFrom: xxxx.xxxx@xxxx.co.uk\nTo: <offer-88206@inbound.xxxx.co.uk>\nCc: xxxx.xxxx@xxxx.co.uk\nMessage-ID: <OFA804C4DE.C8619FB4-ON80257C30.004A7A89-80257C30.004A7A94@xxxx.co.uk>\nDate: Wed, 27 Nov 2013 13:33:30 +0000\nX-Mailer: Lotus Domino Web Server Release 8.5.3FP4 March 27, 2013\nX-MIMETrack: Serialize by HTTP Server on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March\n 27, 2013) at 11\/27\/2013 01:33:30 PM,\n\tSerialize complete at 11\/27\/2013 01:33:30 PM,\n\tItemize by HTTP Server on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at\n 11\/27\/2013 01:33:30 PM,\n\tSerialize by Router on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at\n 11\/27\/2013 01:33:31 PM,\n\tSerialize complete at 11\/27\/2013 01:33:31 PM\nX-KeepSent: A804C4DE:C8619FB4-80257C30:004A7A89;\n type=4; name=$KeepSent\nContent-Transfer-Encoding: quoted-printable\nContent-Type: text\/html;\n\tcharset=ISO-8859-1\n\n<FONT face=3D\"Default Sans Serif,Verdana,Arial,Helvetica,sans-serif\" size=\n=3D2>\n<DIV>Hi Toni,<\/DIV><DIV>&nbsp;<\/DIV><DIV>This is James, the sales manager u=\nsing Leeroy's account! Leeroy has had to run off as his wife is giving birt=\nh!<\/DIV>\n<DIV>&nbsp;<\/DIV><DIV>Can you tell me the model of interest, and your annua=\nl mileage and target payment, we can buildd a deal for you.<\/DIV>\n<DIV>&nbsp;<\/DIV><DIV>Kind regards<BR><\/DIV><DIV>James (on Leeroy's mail!)<=\nBR>\n<BR>Kind regards<BR><BR>Leeroy xxxx<BR>A>\n<BR><BR>xxxx Group<BR>xxxxs a trading name of and Hamp=\nshire Limited. BR>\n<BR>This e-mail is confidential and may also be privileged. If you are not =\nthe..<BR>\n<DIV><BR><\/DIV><FONT color=3D#990099>-----&lt;offer-88206@xxxx.co.uk&gt; =\nwrote: -----<BR>\n<BR><\/FONT><BLOCKQUOTE style=3D\"BORDER-LEFT: #000000 2px solid; PADDING-LEF=\nT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px\">\nTo: Leeroy xxxx &lt;xxxxx@xxxx.co.uk&gt;<BR>From: &lt;offer-8=\n8206@inbound.xxxx.co.uk&gt;<BR>\nSent by: &lt;offer-88206@xxxx.co.uk&gt;<BR>Date: 11\/27\/2013 12:10PM<BR>\nSubject: Leeroy, you have a question from Toni  about offer 88206<=\nBR>\n<BR><CENTER><TABLE style=3D\"PADDING-BOTTOM: 0px; BACKGROUND-COLOR: #f4f4f4;=\n MARGIN: 0px; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-CO=\nLLAPSE: collapse; HEIGHT: 100%; PADDING-TOP: 0px; mso-table-lspace: 0pt; ms=\no-table-rspace: 0pt\" id=3DbodyTable border=3D0 cellSpacing=3D0 cellPadding=\n=3D0 width=3D\"100%\" height=3D\"100%\">\n<TBODY><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; m=\nso-table-rspace: 0pt\" vAlign=3Dtop align=3Dmiddle>\n<!-- \/\/ BEGIN PREHEADER --><TABLE style=3D\"BACKGROUND-COLOR: #ffffff; BORDE=\nR-COLLAPSE: collapse; BORDER-BOTTOM-WIDTH: 0px; mso-table-lspace: 0pt; mso-=\ntable-rspace: 0pt\" id=3DtemplatePreheader border=3D0 cellSpacing=3D0 cellPa=\ndding=3D10 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; m=\nso-table-rspace: 0pt\" vAlign=3Dtop align=3Dmiddle>\n<TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table=\n-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPadding=3D0 width=3D600>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPS=\nE: collapse; FONT-FAMILY: Arial; COLOR: #dddddd; FONT-SIZE: 12px; mso-table=\n-lspace: 0pt; mso-table-rspace: 0pt\" class=3DpreheaderContent vAlign=3Dtop>\n--- WRITE REPLY ABOVE THIS LINE --- <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR>\n<\/TBODY><\/TABLE><!-- END PREHEADER \\\\ --><!-- \/\/ BEGIN TEMPLATE SECTIONS --=\n><TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-tabl=\ne-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPadding=3D0 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; m=\nso-table-rspace: 0pt\" vAlign=3Dtop align=3Dmiddle>\n<!-- \/\/ BEGIN HEADER --><TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-tabl=\ne-lspace: 0pt; mso-table-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPaddin=\ng=3D0 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"BACKGROUND-COLOR: #00a4ff; BORDER-COLLAPSE: collaps=\ne; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; mso-table-lspace: 0pt; =\nmso-table-rspace: 0pt\" id=3DtemplateHeader vAlign=3Dtop align=3Dmiddle>\n<TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table=\n-rspace: 0pt\" class=3DtemplateContainer border=3D0 cellSpacing=3D0 cellPadd=\ning=3D0 width=3D600>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT:=\n 100%; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; BORDER-COLLAPSE: collapse; FO=\nNT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 20px; VERTICAL-ALIGN: middle; =\nFONT-WEIGHT: bold; PADDING-TOP: 0px; mso-table-lspace: 0pt; mso-table-rspac=\ne: 0pt\" class=3DheaderContent>\n<A style=3D\"COLOR: #00a4ff; FONT-WEIGHT: normal; TEXT-DECORATION: underline=\n\" href=3D\"http:\/\/mandrillapp.com\/track\/click.php?u=3D9468237&amp;id=3Dc957c=\nf5cc63e442eaed046d71250d452&amp;url=3Dhttp%3A%2F%2Fquotes.xxxx.co.uk&amp;=\nurl=5Fid=3Db934b2af78697032efe57f20affdda2b09fb10ca\" target=3D=5Fblank>\n<IMG style=3D\"LINE-HEIGHT: 150%; BORDER-RIGHT-WIDTH: 0px; OUTLINE-STYLE: no=\nne; MAX-WIDTH: 600px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORD=\nER-LEFT-WIDTH: 0px; TEXT-DECORATION: none\" id=3DheaderImage src=3D\"http:\/\/g=\nallery.mailchimp.com\/d97bdc4f44006e12654e4f1b6\/images\/xxxx=5Fnewsletter=\n=5Fheader=5Fleft=5Faligned.png\" width=3D600 height=3D100 mc:allowtext=3D\"\" =\nmc:allowdesigner=3D\"\" mc:label=3D\"header=5Fimage\">\n<\/A> <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><!-- END HEADER \\\\=\n --><\/TD>\n<\/TR><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso=\n-table-rspace: 0pt\" vAlign=3Dtop align=3Dmiddle>\n<!-- \/\/ BEGIN BODY --><TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-=\nlspace: 0pt; mso-table-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPadding=\n=3D0 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"PADDING-BOTTOM: 20px; BACKGROUND-COLOR: #ffffff; PA=\nDDING-LEFT: 20px; PADDING-RIGHT: 20px; BORDER-COLLAPSE: collapse; BORDER-TO=\nP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-TOP: 20px; mso-table-lspace=\n: 0pt; mso-table-rspace: 0pt\" id=3DtemplateBody vAlign=3Dtop align=3Dmiddle>\n<TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table=\n-rspace: 0pt\" class=3DtemplateContainer border=3D0 cellSpacing=3D0 cellPadd=\ning=3D0 width=3D600>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPS=\nE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 16px; FONT-WEIG=\nHT: 100; PADDING-TOP: 24px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" c=\nlass=3DbodyContent vAlign=3Dtop>\n<P>Hola Leeroy xxxx,<\/P><BR>A xxx user (Offer id: #088206), Toni from Luton, Luton, has sent you a new message about the xxx they =\nrequested offers for: <P>\n<\/P><BLOCKQUOTE style=3D\"PADDING-BOTTOM: 10px; BACKGROUND-COLOR: #eee; PADD=\nING-LEFT: 10px; PADDING-RIGHT: 10px; COLOR: #444; PADDING-TOP: 10px\">\nHi Leeroy Thank you for your email. Can you please send me some blah blah blah Thanks again Toni <\/BLOCKQUOTE>\n<BR>Login to your dashboard to <P><\/P><TABLE style=3D\"BORDER-COLLAPSE: coll=\napse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" width=3D\"100%\">\n<TBODY><TR><TD style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; m=\nso-table-rspace: 0pt\" align=3Dmiddle>\n<TABLE class=3DtemplateButton border=3D0 cellSpacing=3D0 cellPadding=3D20 w=\nidth=3D300>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: center; LINE-HEIGHT: 100%; BORDER-COLLA=\nPSE: collapse; FONT-FAMILY: Arial; COLOR: #ffffff; FONT-SIZE: 20px; FONT-WE=\nIGHT: 300; TEXT-DECORATION: none; mso-table-lspace: 0pt; mso-table-rspace: =\n0pt\" class=3DtemplateButtonContent vAlign=3Dcenter align=3Dmiddle>\n<A style=3D\"TEXT-ALIGN: center; LINE-HEIGHT: 100%; FONT-FAMILY: Arial; COLO=\nR: #ffffff; FONT-SIZE: 20px; FONT-WEIGHT: 300; TEXT-DECORATION: none\" Respond directly to Toni by replying to this email. Ne=\ned help? Call John, 02020202020. <P>\n<\/P><BR>Regards, <P><\/P><BR>The xxxx team <P><\/P><\/TD><\/TR><\/TBODY><\/TABL=\nE>\n<\/TD><\/TR><\/TBODY><\/TABLE><!-- END BODY \\\\ --><\/TD><\/TR><TR><TD style=3D\"BO=\nRDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAli=\ngn=3Dtop align=3Dmiddle>\n<!-- \/\/ BEGIN FOOTER --><TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-tabl=\ne-lspace: 0pt; mso-table-rspace: 0pt\" border=3D0 cellSpacing=3D0 cellPaddin=\ng=3D0 width=3D\"100%\">\n<TBODY><TR><TD style=3D\"PADDING-BOTTOM: 20px; PADDING-LEFT: 20px; PADDING-R=\nIGHT: 20px; BORDER-COLLAPSE: collapse; BORDER-TOP-WIDTH: 0px; PADDING-TOP: =\n20px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=3DtemplateFooter vAl=\nign=3Dtop align=3Dmiddle>\n<TABLE style=3D\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table=\n-rspace: 0pt\" class=3DtemplateContainer border=3D0 cellSpacing=3D0 cellPadd=\ning=3D0 width=3D600>\n<TBODY><TR><TD style=3D\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPS=\nE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; mso-table=\n-lspace: 0pt; mso-table-rspace: 0pt\" class=3DfooterContent vAlign=3Dtop col=\nSpan=3D3>\n<A style=3D\"COLOR: #606060; FONT-WEIGHT: 100; TEXT-DECORATION: underline\" h=\nref=3D\"http:\/\/mandrillapp.com\/track\/click.php?u=&amp;id==\nc6&amp;url=3Dhttp%3A%2F%2Ftwitter.com%2F&amp;=\nurl=5Fid=\" target=3D=5Fself>\nFollow on Twitter<\/A>&nbsp;&nbsp;&nbsp;<A style=3D\"COLOR: #606060; FONT-WEI=\nGHT: 100; TEXT-DECORATION: underline\" href=3D\"http:\/\/mandrillapp.com\/track\/=\nclick.php?u=&amp;id=&amp;url=3Dh=\nttp%3A%2F%2Fwww.facebook.com%2F&amp;url=5Fid==\nfc5dadc29bc1e18f56\" target=3D=5Fself>\nLike on Facebook<\/A>&nbsp;<\/TD><\/TR><TR><TD style=3D\"TEXT-ALIGN: left; PADD=\nING-BOTTOM: 20px; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY=\n: Arial; COLOR: #686c70; FONT-SIZE: 10px; PADDING-TOP: 20px; mso-table-lspa=\nce: 0pt; mso-table-rspace: 0pt\" class=3DfooterContent vAlign=3Dtop>\n<EM>Copyright =A9 2013   Ltd, All rights reserved.<\/EM> <BR><BR>\n<\/TD><\/TR><TR><TD style=3D\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLL=\nAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; mso-ta=\nble-lspace: 0pt; mso-table-rspace: 0pt\" class=3DfooterContent vAlign=3Dtop =\ncolSpan=3D3>\n<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN> <SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN>\n <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><!-- END FOOTER \\\\ -->=\n<\/TD>\n<\/TR><\/TBODY><\/TABLE><!-- END TEMPLATE SECTIONS \\\\ --><\/TD><\/TR><\/TBODY>\n<\/TABLE><\/CENTER><IMG src=3D\"http:\/\/mandrillapp.com\/track\/open.php?u==\n237&id=3Dc95\" width=3D1 height=3D1>\n <BR><\/BLOCKQUOTE><BR><\/DIV><\/FONT>",
      "headers": {
        "Received": [
          "from xxxx.xxx.xxx.net (mail.xxx.co.uk [00.00.00.00]) by ip-00-00-00-00 (Postfix) with ESMTP id 642254A820F for <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 13:33:32 +0000 (UTC)",
          "from xxxx.xxxx.xxxx.xxxx (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id F3EE6101E628_295E809B for <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 12:39:37 +0000 (GMT)",
          "from xxxx.xxxx.co.uk (unknown [00.00.00.00]) by xxxx.xxxx.xxxx.net (Sophos Email Appliance) with ESMTP id E041E10CAFD0_295E809F for <offer-88206@inbound.xxxx.co.uk>; Wed, 27 Nov 2013 12:39:37 +0000 (GMT)"
        ],
        "Importance": "Normal",
        "X-Priority": "3 (Normal)",
        "In-Reply-To": "<5295e0a55ab73_29e0ebc103b1@4830b3e0-2675-41d3-8df8-dc78e0a45544.mail>",
        "References": "<5295e0a55ab73_29e0ebc103b1@4830b3e0-2675-41d3-8df8-dc78e0a45544.mail>",
        "Subject": "Re: Leeroy, you have a question from Toni   about offer 88206",
        "Mime-Version": "1.0",
        "From": "xxxx.xxxx@xxxx.co.uk",
        "To": "<offer-88206@inbound.xxxx.co.uk>",
        "Cc": "xxxx.xxxx@xxxx.co.uk",
        "Message-Id": "<OFA804C4DE.C8619FB4-ON80257C30.004A7A89-80257C30.004A7A94@xxxxx.co.uk>",
        "Date": "Wed, 27 Nov 2013 13:33:30 +0000",
        "X-Mailer": "Lotus Domino Web Server Release 8.5.3FP4 March 27, 2013",
        "X-Mimetrack": "Serialize by HTTP Server on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at 11\/27\/2013 01:33:30 PM, Serialize complete at 11\/27\/2013 01:33:30 PM, Itemize by HTTP Server on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at 11\/27\/2013 01:33:30 PM, Serialize by Router on sde184notes5\/DCUKDECERT(Release 8.5.3FP4|March 27, 2013) at 11\/27\/2013 01:33:31 PM, Serialize complete at 11\/27\/2013 01:33:31 PM",
        "X-Keepsent": "A804C4DE:C8619FB4-80257C30:004A7A89; type=4; name=$KeepSent",
        "Content-Transfer-Encoding": "quoted-printable",
        "Content-Type": "text\/html; charset=ISO-8859-1"
      },
      "html": "<FONT face=\"Default Sans Serif,Verdana,Arial,Helvetica,sans-serif\" size=2>\n<DIV>Hi Toni,<\/DIV><DIV>&nbsp;<\/DIV><DIV>This is James, the sales manager using Leeroy's account! Leeroy has had to run off as his wife is giving birth!<\/DIV>\n<DIV>&nbsp;<\/DIV><DIV>Can you tell me the model of interest, and your annual mileage and target payment, we can buildd a deal for you.<\/DIV>\n<DIV>&nbsp;<\/DIV><DIV>Kind regards<BR><\/DIV><DIV>James (on Leeroy's mail!)<BR>\n<BR>Kind regards<BR>90099>-----&lt;offer-88206@xxxx.co.uk&gt; wrote: -----<BR>\n<BR><\/FONT><BLOCKQUOTE style=\"BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px\">\nTo: Leeroy xxxx &lt;xxxx@xxxxx.co.uk&gt;<BR>From: &lt;offer-88206@inbound.xxxx.co.uk&gt;<BR>\nSent by: &lt;offer-88206@xxxx.co.uk&gt;<BR>Date: 11\/27\/2013 12:10PM<BR>\nSubject: Leeroy, you have a question from Toni  about offer 88206<BR>\n<BR><CENTER><TABLE style=\"PADDING-BOTTOM: 0px; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0px; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-COLLAPSE: collapse; HEIGHT: 100%; PADDING-TOP: 0px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=bodyTable border=0 cellSpacing=0 cellPadding=0 width=\"100%\" height=\"100%\">\n<TBODY><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<!-- \/\/ BEGIN PREHEADER --><TABLE style=\"BACKGROUND-COLOR: #ffffff; BORDER-COLLAPSE: collapse; BORDER-BOTTOM-WIDTH: 0px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=templatePreheader border=0 cellSpacing=0 cellPadding=10 width=\"100%\">\n<TBODY><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=600>\n<TBODY><TR><TD style=\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #dddddd; FONT-SIZE: 12px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=preheaderContent vAlign=top>\n--- WRITE REPLY ABOVE THIS LINE --- <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR>\n<\/TBODY><\/TABLE><!-- END PREHEADER \\\\ --><!-- \/\/ BEGIN TEMPLATE SECTIONS --><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=\"100%\">\n<TBODY><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<!-- \/\/ BEGIN HEADER --><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=\"100%\">\n<TBODY><TR><TD style=\"BACKGROUND-COLOR: #00a4ff; BORDER-COLLAPSE: collapse; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=templateHeader vAlign=top align=middle>\n<TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=templateContainer border=0 cellSpacing=0 cellPadding=0 width=600>\n<TBODY><TR><TD style=\"TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 100%; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 20px; VERTICAL-ALIGN: middle; FONT-WEIGHT: bold; PADDING-TOP: 0px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=headerContent>\n<A style=\"COLOR: #00a4ff; FONT-WEIGHT: normal; TEXT-DECORATION: underline\" href=\"http:\/\/mandrillapp.com\/track\/click.php?u=9468237&amp;id=c957cf5cc63e442eaed046d71250d452&amp;url=http%3A%2F%2Fquotes.xxxx.co.uk&amp;url_id=b934b2af78697032efe57f20affdda2b09fb10ca\" target=_blank>\n<IMG style=\"LINE-HEIGHT: 150%; BORDER-RIGHT-WIDTH: 0px; OUTLINE-STYLE: none; MAX-WIDTH: 600px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; TEXT-DECORATION: none\" id=headerImage src=\"http:\/\/gallery.mailchimp.com\/d97bdc4f44006e12654e4f1b6\/images\/xxxx.png\" width=600 height=100 mc:allowtext=\"\" mc:allowdesigner=\"\" mc:label=\"header_image\">\n<\/A> <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><!-- END HEADER \\\\ --><\/TD>\n<\/TR><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<!-- \/\/ BEGIN BODY --><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=\"100%\">\n<TBODY><TR><TD style=\"PADDING-BOTTOM: 20px; BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; BORDER-COLLAPSE: collapse; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-TOP: 20px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=templateBody vAlign=top align=middle>\n<TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=templateContainer border=0 cellSpacing=0 cellPadding=0 width=600>\n<TBODY><TR><TD style=\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 16px; FONT-WEIGHT: 100; PADDING-TOP: 24px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=bodyContent vAlign=top>\n<P>Hola Leeroy xxxx,<\/P><BR>A xxxx user (Offer id: #088206), Toni  from Luton, Luton, has sent you a new message about the xxxx they requested offers for: <P>\n<\/P><BLOCKQUOTE style=\"PADDING-BOTTOM: 10px; BACKGROUND-COLOR: #eee; PADDING-LEFT: 10px; PADDING-RIGHT: 10px; COLOR: #444; PADDING-TOP: 10px\">\nHi Leeroy Thank you for your email. Can you please send me some business lease quotes and\/or PCP quotations as I am looking for this car to be my company car. Thanks again Toni <\/BLOCKQUOTE>\n<BR>Login to your dashboard to <P><\/P><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" width=\"100%\">\n<TBODY><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" align=middle>\n<TABLE class=templateButton border=0 cellSpacing=0 cellPadding=20 width=300>\n<TBODY><TR><TD style=\"TEXT-ALIGN: center; LINE-HEIGHT: 100%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #ffffff; FONT-SIZE: 20px; FONT-WEIGHT: 300; TEXT-DECORATION: none; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=templateButtonContent vAlign=center align=middle>\n<A style=\"TEXT-ALIGN: center; LINE-HEIGHT: 100%; FONT-FAMILY: Arial; COLOR: #ffffff; FONT-SIZE: 20px; FONT-WEIGHT: 300; TEXT-DECORATION: none\" href=\"http:\/\/mandrillapp.com\/track\/click.php?u=9468237&amp;id=c957cf5cc63e442eaed046d71250d452&amp;url=http%3A%2F%2Fquotes.xxxx.co.uk%2Fdealers%2Foffers%2F88206&amp;url_id=78aafdf8a19763ba7e0967d15e22e4b499d1a2b0\" target=blank>\nSee the details of this lead<\/A> <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY>\n<\/TABLE><BR><SPAN style=\"COLOR: #2ecc71; FONT-WEIGHT: 500\">NEW FEATURE <\/SPAN>\n&amp;dash; Respond directly to Toni  by replying to this email. Need help? Call John, 02076111065. <P>\n<\/P><BR>Regards, <P><\/P><BR>The xxxx team <P><\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<\/TD><\/TR><\/TBODY><\/TABLE><!-- END BODY \\\\ --><\/TD><\/TR><TR><TD style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" vAlign=top align=middle>\n<!-- \/\/ BEGIN FOOTER --><TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" border=0 cellSpacing=0 cellPadding=0 width=\"100%\">\n<TBODY><TR><TD style=\"PADDING-BOTTOM: 20px; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; BORDER-COLLAPSE: collapse; BORDER-TOP-WIDTH: 0px; PADDING-TOP: 20px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" id=templateFooter vAlign=top align=middle>\n<TABLE style=\"BORDER-COLLAPSE: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=templateContainer border=0 cellSpacing=0 cellPadding=0 width=600>\n<TBODY><TR><TD style=\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=footerContent vAlign=top colSpan=3>\n<A style=\"COLOR: #606060; FONT-WEIGHT: 100; TEXT-DECORATION: underline\" href=\"http:\/\/mandrillapp.com\/track\/click.php?u=9468237&amp;id=c957cf5cc63e442eaed046d71250d452&amp;url=http%3A%2F%2Ftwitter.com%2Fxxxx&amp;url_id=35530deb3e3923de4d66154d775dcf7307d15aa1\" target=_self>\nFollow on Twitter<\/A>&nbsp;&nbsp;&nbsp;<A style=\"COLOR: #606060; FONT-WEIGHT: 100; TEXT-DECORATION: underline\" href=\"http:\/\/mandrillapp.com\/track\/click.php?u=9468237&amp;id=c957cf5cc63e442eaed046d71250d452&amp;url=http%3A%2F%2Fwww.facebook.com%2Fxxxx&amp;url_id=a0de7c9d161d1d0f65433dfc5dadc29bc1e18f56\" target=_self>\nLike on Facebook<\/A>&nbsp;<\/TD><\/TR><TR><TD style=\"TEXT-ALIGN: left; PADDING-BOTTOM: 20px; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; PADDING-TOP: 20px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=footerContent vAlign=top>\n<EM>Copyright \u00a9 2013 Digital Blurb Ltd, All rights reserved.<\/EM> <BR><BR>\n<\/TD><\/TR><TR><TD style=\"TEXT-ALIGN: left; LINE-HEIGHT: 150%; BORDER-COLLAPSE: collapse; FONT-FAMILY: Arial; COLOR: #686c70; FONT-SIZE: 10px; mso-table-lspace: 0pt; mso-table-rspace: 0pt\" class=footerContent vAlign=top colSpan=3>\n<SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN> <SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<\/SPAN>\n <\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><!-- END FOOTER \\\\ --><\/TD>\n<\/TR><\/TBODY><\/TABLE><!-- END TEMPLATE SECTIONS \\\\ --><\/TD><\/TR><\/TBODY>\n<\/TABLE><\/CENTER><IMG src=\"http:\/\/mandrillapp.com\/track\/open.php?u=9468237&id=c957cf5cc63e442eaed046d71250d452\" width=1 height=1>\n <BR><\/BLOCKQUOTE><BR><\/DIV><\/FONT>",
      "from_email": "Leeroy.xxxx@xxxx.co.uk",
      "to": [
        [
          "offer-88206@inbound.xxxx.co.uk",
          null
        ]
      ],
      "cc": [
        [
          "xxxx.xxxx@xxxx.co.uk",
          null
        ]
      ],
      "subject": "Re: Leeroy, you have a question from Toni   about offer 88206",
      "spam_report": {
        "score": 3.1,
        "matched_rules": [
          {
            "name": "URIBL_BLOCKED",
            "score": 0,
            "description": "ADMINISTRATOR NOTICE: The query to URIBL was blocked."
          },
          {
            "name": null,
            "score": 0,
            "description": null
          },
          {
            "name": "more",
            "score": 0,
            "description": "information."
          },
          {
            "name": "xxxxxxxx.co.uk]",
            "score": 0,
            "description": null
          },
          {
            "name": "RCVD_IN_DNSWL_NONE",
            "score": 0,
            "description": "RBL: Sender listed at http:\/\/www.xxxx.org\/, no"
          },
          {
            "name": "listed",
            "score": 0,
            "description": "in list.xxxx.org]"
          },
          {
            "name": "URI_HEX",
            "score": 1.3,
            "description": "URI: URI hostname has long hexadecimal sequence"
          },
          {
            "name": "HTML_MESSAGE",
            "score": 0,
            "description": "BODY: HTML included in message"
          },
          {
            "name": "MIME_HTML_ONLY",
            "score": 1.1,
            "description": "BODY: Message only has text\/html MIME parts"
          },
          {
            "name": "HTML_MIME_NO_HTML_TAG",
            "score": 0.6,
            "description": "HTML-only message, but there is no HTML tag"
          }
        ]
      },
      "dkim": {
        "signed": false,
        "valid": false
      },
      "spf": {
        "result": "none",
        "detail": ""
      },
      "email": "offer-88206@inbound.xxxx.co.uk",
      "tags": [

      ],
      "sender": null,
      "template": null
    }
  }
]
tardate commented 10 years ago

Are you looking for sender_email? Don't have a from_email accessor defined on the decorator at the moment.

# Returns the email (String) of the sender.
# Applicable events: inbound
def sender_email
  msg['from_email']
end
tardate commented 10 years ago

@soulnafein did that help/did you fix the error? I'm going to close the issue, but just reply/re-open if there's more

Zeneixe commented 10 years ago

Actually, still having the problem!

I answer you: we use sender_email accessor

tardate commented 10 years ago

Very strange. I checked again, and the Mandril::Rails code never tries to call a method called 'from_email'. Can you grep your sources for 'from_email' .. something must be trying to call it!

Zeneixe commented 10 years ago

OK, the callstack is wrong, the problem is that we get a nil message_body, try running this spec with that breaking fixture. Hope the spec is correct! I never used this syntax.

  describe "#message_body" do
    let(:raw_event) { webhook_example_event('inbound_breaking') }
    let(:event_payload) { Mandrill::WebHook::EventDecorator[raw_event] }
    subject { event_payload.message_body }
    describe "Crash test" do
      it { should_not be_nil }
    end
  end
tardate commented 10 years ago

I just added some tests for a case when msg is not present in the webhook post (although this should never happen?). Can't make it break through.

Can you post/push/email me your 'inbound_breaking' payload? Does it look legit according to the Mandrill docs?

tardate commented 10 years ago

ahah. I added the example you posted earlier and discovered the issue is that if you just ask for EventDecorator#message_body (without specifying the format you want), it will try and return the text body content. But the example you have here is a message with HTML-only. So unless you ask for message_body(:html), it will be nil.

I've just updated the behaviour of message_body:

# Returns the +format+ (:text,:html,:raw) message body.
# If +format+ is not specified, it will return the first available message content in order: text, html, raw.
# Applicable events: inbound
def message_body(format=nil)
tardate commented 10 years ago

PS: that's now in gem version 1.0.1

Zeneixe commented 10 years ago

Great, so you also released a new gem version? Thanks!

Zeneixe commented 10 years ago

I confirm it's fixed also on our application after updating the gem