Users are experiencing issues forwarding email notifications from one Discourse server to another, resulting in bounced messages and an error: undefined method 'lines' for nil:NilClass. downey initially reported the problem, noting it occurs with both manually forwarded emails and those forwarded by others using Outlook/Exchange. maiki suggested checking the block auto generated emails setting, which led downey to discover the error in the rejected email logs. sam confirmed the error points to a bug and noted forwarded emails may still be blocked due to headers resembling bulk mail. zogstrip assigned the issue to gerhard, who, despite not reproducing the issue, identified and fixed the underlying code flaw in commit 99181bb. gerhard requested a raw email sample for verification but proceeded with the fix regardless. Users are advised to report any ongoing issues with forwarded emails as new bugs.
Receive a useful email notification from Discourse Site A, via a category you are “Watching First Post” for.
Forward that email notification into Discourse Site B, via an email address set up to create new messages to an existing group.
Expected result
The content is processed correctly and a private message is generated.
Actual result
The email is not processed, the message is not created, and this bounce back email notification to forwarder:
We’re sorry, but your email message to discourse-site-b@example.org (titled Fw: [Discourse Site A] [Announcements] Big News) didn’t work. There was an unrecognized error while processing your email and it wasn’t posted. You should try again, or contact a staff member.
Thanks for that thought. Since I forwarded the email by hand from my email client, I didn’t send that header, but your comment did inspire me to look to see if there was in fact something simiilar in the error logs.
The error turned up in /admin/email/rejected:
undefined method 'lines' for nil:NilClass
Not sure if that’s helpful for someone more clueful than I.
Update: Another data point. I got the same rejection email and same logged error as above, when trying to forward in another human’s email. This makes me think it might be something more related to how the Microsoft Outlook/Exchange client is processing forwarded messages. Investigation on my end will continue.
That certainly sounds like a bug we should fix, that said, even after that is fixed the email you are forwarding has some headers that make us think it is a bulk emailer of sorts, you would have to whitelist that somehow.
@zogstrip we should probably assign the lines nil class thing out?
Ostensibly if this bug is resolved, would I be able to gain some more insights why the mail is being blocked?
I will look more closely at the headers my server might be adding. Also happy to share them individually if others want a closer look; but it may be early for that.
I can’t reproduce the problem, but I see where the code might fail. @downey Could you please send me the raw email in a PM? I’d like to make sure that I’m applying the correct fix.