https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292014-02-18T23:21:28ZRedmineRedmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=548922014-02-18T23:21:28ZToshi MARUYAMA
<ul><li><strong>File</strong> deleted (<del><i>gmail-iso8859-2.eml</i></del>)</li></ul> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=548932014-02-18T23:21:50ZToshi MARUYAMA
<ul><li><strong>Category</strong> set to <i>Email receiving</i></li></ul> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=548942014-02-18T23:22:27ZToshi MARUYAMA
<ul></ul><p>I removed attachment because it includes private data.</p> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=548952014-02-19T01:35:18ZToshi MARUYAMA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Needs feedback</i></li><li><strong>Resolution</strong> set to <i>Duplicate</i></li></ul><p>I added test and test passes.</p> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=548992014-02-19T09:40:40ZVedran Rodic
<ul></ul><p>When trying with my original file it doesn't pass, but that might be a test infrastructure problem.</p>
<p>Your file passes the test, so I guess the test isn't complete. I'll try to investigate by printing out what we get from our email system but I'm a ruby newbie and would like to have some advice on how to proceed.</p>
<p>Btw, this is the output when running with my original .eml file, how to get a full trace of the failure instead of just this:<br />~/redmine-2.4.3]# ruby test/unit/mail_handler_test.rb -n test_gmail_iso8859_2<br />Run options: -n test_gmail_iso8859_2</p>
<ol>
<li>Running tests:</li>
</ol>
<p>F</p>
<p>Finished tests in 3.561271s, 0.2808 tests/s, 0.2808 assertions/s.</p>
<pre><code>1) Failure:<br />test_gmail_iso8859_2(MailHandlerTest) [test/unit/mail_handler_test.rb:535]:<br />Expected false to be a kind of Issue, not FalseClass.</code></pre>
<p>1 tests, 1 assertions, 1 failures, 0 errors, 0 skips</p> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=549002014-02-19T10:01:28ZVedran Rodic
<ul></ul><p>Okay, my original report is not complete.</p>
<p>I added puts(msg) in imap.rb to see the complete message we get get from our system and it contained this (containing part of my signature):</p>
<p>X-Ham-Report: Spam detection software, running on the system "xxxxxxx", has<br /> identified this incoming email as possible spam. The original message<br /> has been attached to this so you can view it (if it isn't spam) or label<br /> similar future email. If you have any questions, see<br /> root\@localhost for details.</p>
<pre><code>Content preview: -- Vedran Rodi� Software developer Tau on-line d.o.o. Hondlova<br /> 2/11, HR-10000 Zagreb Phone+385 (1) xxxxxxx [...] <br /> X-Spam-Flag: NO</code></pre>
<p>Now, this � is not in any encoding mentioned anywhere.</p>
<p>This is added by our SpamAssassin setup, which might be buggy.</p>
<p>I have a feeling that redmine shouldn't just abort processing this message in these cases, but it's your choice on how to handle this.</p> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=549052014-02-19T12:03:00ZToshi MARUYAMA
<ul><li><strong>Subject</strong> changed from <i>error with redmine:email:receive when receiving ISO-8859-2 mails mailed from gmail</i> to <i>redmine:email:receive should not abort with buggy mail</i></li><li><strong>Status</strong> changed from <i>Needs feedback</i> to <i>New</i></li><li><strong>Resolution</strong> deleted (<del><i>Duplicate</i></del>)</li></ul> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=553322014-03-14T13:30:29ZToshi MARUYAMA
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/16261">Defect #16261</a>: tasks by email</i> added</li></ul> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=599172014-11-20T15:32:50ZAndre Oliveira
<ul></ul><p>I solved that problem in my company by forcing the encoding...</p>
<p>In redmine_folder/app/models/mail_handler.rb</p>
<p>add:<br />email.force_encoding('UTF-8')</p>
<p>after:<br />def self.receive(email, options={})</p>
<p>and remove:<br />email.force_encoding('ASCII-8BIT') if email.respond_to?(:force_encoding)</p>
<p>Hope it helps</p> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=599372014-11-21T17:16:09ZToshi MARUYAMA
<ul></ul><p>Luis Fontes wrote:</p>
<blockquote>
<p>I solved that problem in my company by forcing the encoding...</p>
<p>In redmine_folder/app/models/mail_handler.rb</p>
<p>add:<br />email.force_encoding('UTF-8')</p>
</blockquote>
<p>Could you try this instead?</p>
<pre><code>email.force_encoding('ASCII-8BIT')</code></pre>
<p>Because Rails 4 porting has this code.<br /><a class="source" href="https://www.redmine.org/projects/redmine/repository/svn/revisions/13623/entry/trunk/app/models/mail_handler.rb#L45">source:trunk/app/models/mail_handler.rb@13623#L45</a></p>
<blockquote>
<p>after <br />def self.receive(email, options={})</p>
</blockquote> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=604072014-12-16T02:41:07ZToshi MARUYAMA
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/18649">Defect #18649</a>: mail_handler.rb - does not encode non-utf8 characters</i> added</li></ul> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=604212014-12-17T02:44:04ZToshi MARUYAMA
<ul></ul><p>FTR:<br />In <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: mail_handler.rb - does not encode non-utf8 characters (Closed)" href="https://www.redmine.org/issues/18649">#18649</a>, there is request that Redmine should not ignore but replace invalid characters.</p> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=607142015-01-07T16:58:33ZAndre Oliveira
<ul></ul><p>Toshi MARUYAMA wrote:</p>
<blockquote>
<p>Could you try this instead?</p>
<p>email.force_encoding('ASCII-8BIT')</p>
<p>Because Rails 4 porting has this code.<br /><a class="source" href="https://www.redmine.org/projects/redmine/repository/svn/revisions/13623/entry/trunk/app/models/mail_handler.rb#L45">source:trunk/app/models/mail_handler.rb@13623#L45</a></p>
</blockquote>
<p>That did not work in my case,I forgot to tell to remove that line.</p>
<p>When I did this changes emails without subject were causing errors too, because an Issue needs to have the subject, so if anyone has this problem too just need to add</p>
<p>issue.subject = '(no subject)' if issue.subject.blank?</p>
<p>after <br />issue.subject = cleaned_up_subject</p>
<p>(this is in the receive_issue method)</p> Redmine - Defect #16122: redmine:email:receive should not abort with buggy mailhttps://www.redmine.org/issues/16122?journal_id=872792018-09-15T05:05:49ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-3 status-5 priority-4 priority-default closed" href="/issues/29614">Patch #29614</a>: redmine:email:read and rdm-mailhandler.rb should use safe_receive instead of receive</i> added</li></ul>