jfqd / redmine_helpdesk

Lightweight helpdesk plugin for redmine.
MIT License
192 stars 102 forks source link

Error when message hasn't "To:" header #158

Closed lmorillas closed 3 years ago

lmorillas commented 3 years ago

The "to:" header isn't mandatory in imap and some clients doesn't include it or maybe the user sends a message with a bcc header. If the message has no "to" header, helpdesk raises an ERROR: ERROR -- : MailHandler: an unexpected error occurred when receiving email: undefined methodformatted' for nil:NilClass It creates an issue but incomplete: without the owner-email header i.e.

You can test it with a fixture without the to header:

Return-Path: <john.doe@somenet.foo>
Received: from osiris ([127.0.0.1])
    by OSIRIS
    with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
From: "John Doe" <john.doe@somenet.foo>
Subject: Ticket by unknown user
Date: Sun, 22 Jun 2008 12:28:07 +0200
MIME-Version: 1.0
Content-Type: text/plain;
    format=flowed;
    charset="iso-8859-1";
    reply-type=original
Content-Transfer-Encoding: 7bit

This is a ticket submitted by an unknown user.

I've sent a pull request for it

jfqd commented 3 years ago

Thx for creating your pull request. Merged it today.