Closed wingice closed 9 years ago
I fix the the issue by adding extra checking:
- headers = params['message-headers'].select do |h|
+ message_headers = params['message-headers']
+ message_headers = JSON.parse(message_headers) if message_headers.is_a?(String)
+
+ headers = message_headers.select do |h|
I don't know whether it is an acceptable fix. If it is ok, I can make a pull request from my fork.
I saw a warning in the log, it may be the cause: not translating string to Json.
There are some unicodes chars(UTF-8, Chinese) in those fields.
WARNING: Could not parse (and so ignoring) '[["Received", "by luna.mailgun.net with SMTP mgrt 8775751066621; Fri, 04 Apr 2014 08:15:34 +0000"], ["X-Envelope-From", ""], ["Received", "from corp.21cn.com (corp.forptr.21cn.com [121.14.129.38]) by mxa.mailgun.org with ESMTP id 533e6a1d.477bb20-in2; Fri, 04 Apr 2014 08:15:25 -0000 (UTC)"], ["Received", "from ip?180.166.63.178? (entas7.inner-hermes.com [10.27.101.7])\tby corp.21cn.com (HERMES) with ESMTP id 69DF9484033\tfor ; Fri, 4 Apr 2014 16:15:10 +0800 (CST)"], ["Hmm_attache_num", "0001"], ["Hmm_source_ip", "wmail.10.27.101.7.933431481"], ["Hmm_source_type", "WEBMAIL"], ["Received", "from ip<180.166.63.178> ([180.166.63.178])\tby 21CN-ent7(MEDUSA 10.27.101.7) with ESMTP id 1396599307.27191 for pktrwvwoh.hellotechnologies@talentlists.com\t;\tFri Apr 4 16:15:17 2014"], ["1/x-Total-Score", "-62:"], ["X-Filter-Score", "to=<918c959398979890894f89868d8d90958684898f908d90888a86946195828d868f958d8a9495944f84908e>, score=<1396599317Vo8FwwwwwHwwPwwswHPsXzGU60VVVVV7VVBVVYV7BYDa> "], ["X-Real-From", "rd@cosunet.com.cn"], ["X-Receive-Ip", "180.166.63.178 rd@cosunet.com.cn"], ["Date", "Fri, 4 Apr 2014 16:15:07 +0800 (CST)"], ["From", "rd@cosunet.com.cn"], ["To", "\"pktrwvwoh.hellotechnologies\" "], ["Message-Id", "<172189816.6421396599310618.JavaMail.hermes@ent-web5>"], ["Subject", "Fw: (51job.com)\u7533\u8bf7\u8d35\u516c\u53f8C# .Net \u9ad8\u7ea7\u8f6f\u4ef6\u5de5\u7a0b\u5e08\uff08\u4e0a\u6d77\uff09\uff0d\u77f3\u946b"], ["Mime-Version", "1.0"], ["Content-Type", "multipart/mixed; boundary=\"----=_Part_673_1412613781.1396599307337\""], ["Hmm_webcln_ip", "10.27.10.86"], ["X-Hermes-Sendmode", "normal"], ["X-Hermes-Set", "CC2fLruzRNbroHaQFnf1nCpRJnBb8J7v"], ["X-Mailgun-Incoming", "Yes"], ["X-Mailgun-Sflag", "No"], ["X-Mailgun-Sscore", "0.0"], ["X-Mailgun-Spf", "Neutral"]]'
I can also replicate this issue via https://mailgun.com/cp/routes using the "Send A Sample POST" test function.
I have installed tested your changes and they has resolved the problem for me - so thanks very much!!!
I say you should make a pull request.
@calebthompson my adapter is mandrill not mailgun
Whoops!
mailgun sends the headers as JSON and this is fixed in the extracted version.
Great, so should this be closed as fixed for 1.0 and on master?
Or, I guess along with the apart to remove the adapter from Griddler.
Sorry I didn't get back about this sooner. I'd also like to fix this in the non-extracted version if that would be helpful. Is the best way to do that to check out the version tagged 0.6.4 and make a branch to fix in from there?
Yeah, and we could cut 0.6.5 for that, but I'd intended to EOL 0.6.* as soon as 1.0.0 came out, which should be in the next couple of days. If you feel strongly, we can do it and cut a release. Up to you @bradpauly
Hmm, it's in a branch but I don't want to create extra work if it isn't needed. @ryanharnwell @wingice do you plan to move to 1.0? Or are there any reasons you don't want to upgrade?
I'd be happy to upgrade to 1.0 when released.
This should be good in the released version.
Mailgun adapter: receiving mail without CC field:
It seems params["message-headers"] is a string , not an array.