Incoming emails getting rejected with NoBodyDetectedError

We have a category of our Discourse instance set up as a “mailbox” for incoming emails (making use of the “Custom incoming email address” setting). This is working great, except for when two people send us an email with the same subject.

What I’d like is for Discourse to just create a new thread for each email, and I have “Allow topics with identical, duplicate titles.” turned on. What actually happens is that the second email gets rejected with a Email::Receiver::NoBodyDetectedError error. When I click on this error in the admin panel, I can clearly see content in the “body” box.

Is there something I can do to make this work? Or is it a bug?

Are you sure it’s the same subject that’s triggering that issue? Usually, this error happens when we can’t extract a body from the email.

2 Likes

Ah… sorry, the same subject thing may have been a red herring. But we are still getting a lot of emails rejected. This is what I see when I click the error, and there’s obviously content in the “body” box… is there a way of getting more info so I can work out why discourse can’t extract the content?

Can you send me the raw emails via PM?

I can do, but how do I access the raw email? Do you just want the content of the boxes I screenshotted above?

Ok, this is a bit convoluted but here’s how to get the raw version of the email

  • open the network tab of your browser’s console
  • click the name of the error (this should open the modal)
  • look for a network request that looks like http://your.discourse/admin/email/incoming/<id>.json
  • add “/raw” before “.json” like so http://your.discourse/admin/email/incoming/<id>/raw.json
4 Likes

Was this sorted @david? :laughing:

Well… kinda. I hacked the email receiver to stop it stripping forwarded/reply content, so then the emails “had a body”.

https://github.com/nottinghamtec/discourse-tec-email-tweak/blob/master/plugin.rb#L10-L30

From the PM I sent @zogstrip many years ago, this is what we were trying to do:

  1. A member of the public emails us at info@domain.invalid

  2. This gets automatically forwarded to infotoforum@forum.domain.invalid

  3. Discourse receives the mail, and creates a new topic in the “Info@” category. The “Custom incoming email address” for that category is set to “infotoforum@forum.domain.invalid”. The post is made as the “info@forum.domain.invalid” user, which is effectively a “system” account.

The convoluted forwarding was introduced because we wanted incoming email without staged users. We never want the people sending the emails to know that the Discourse forum exists. Judging by the lack of anyone else posting about this on Meta, I think it’s a pretty rare way to use Discourse :man_shrugging:.

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.