Outlook email files attached to emails sent to Discourse are stripped and not delivered

AI-generated summary

User Adam_Glebowicz reports that Outlook email files (.msg, converted to .eml) attached to emails sent to Discourse via email-in are being stripped and not delivered, despite all attachment-related settings being configured to allow them. He suspects the issue lies in Discourse’s email processing code, not his Bitnami installation. zogstrip requests a sample .eml file for testing and later notes that Discourse now includes an email notification explaining why attachments are rejected, available in the latest version. Adam_Glebowicz notes he’s on an older Bitnami version (2.1.2) and asks if the team can test the .eml attachment on the latest beta to share the rejection error. Stephen clarifies that Bitnami installs are unsupported and recommends migrating to the official install. Adam_Glebowicz insists the issue is in Discourse’s attachment handling, not Bitnami, and reiterates his request for the error message from the latest version. Stephen replies that testing on newer versions is the user’s responsibility. Finally, maja announces a fix has been merged: .eml files are no longer stripped from incoming emails — commit.

Hello,

I’m posting this here as I could not find any discussion touching my exact issue.
We’re using the email-in functionality heavily in our Discourse instance.
All email attachments are delivered properly to new topics in Discourse except the Outlook email files.
The file gets stripped somewhere on the way and doesn’t arrive to Discourse.
The email attachments we send have a “.msg” extension and when they arrive to the inbox (from which Discourse fetches emails) they are converted to the “.eml” extension.

I checked all related Discourse settings:

  • attachment content type blacklist - I cleaned all values
  • attachment filename blacklist - I cleaned all values
  • authorized extensions - it’s set to “*”

I can see the same files are allowed to be attached to posts when added from Discourse GUI - they are only blocked via email. When sent from email, those attachments don’t even get added to Discourse’s uploads table in DB - they’re stripped somewhere on the way. I checked the email & upload processing files, like:

  • lib/email/receiver.rb
  • lib/email/processor.rb
  • lib/email.rb
  • lib/upload_creator.rb
  • lib/validators/upload_validator.rb
    but I don’t see any place where this stripping could occur in any hardcoded way.

Is this a known bug/feature?
Do you know which file/method could be the culprit for this behavior?

Regards,
Adam

Not sure, any ideas @zogstrip?

Interesting :thinking:

Could you send one of those email to regis.hanol@discourse.org so that I can have a look?

Sure, just did it this minute.

Regards,
Adam

Hello,

Any update on this one?

Regards,
Adam

Sorry, hadn’t had time to check.

But, we’ve added an email that will tell you why an attachment was rejected.

Can you upgrade to latest and test again?

Hello,

I can see that change is included in the latest 2.2.0 beta3, but I’m running a Bitnami stack of Discourse.
It’s currently at 2.1.2 the latest and it’s going to take a while before it’s updated to this version.

Can you try emailing any of the .eml attachments to the newest beta version on your side and forward me the error you’ll get?

Regards,
Adam

We don’t really support bitnami installs for this reason.

You’re best off looking at migrating your data to a fresh build using the official install guide:

https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md

Hello,

I understand your standpoint, but the root cause is not in the Bitnami stack, but in Discourse attachment handling somewhere :slight_smile:
I just wanted to know at least an error message you get, now that you support attachment error messages in the newest build.

Regards,
Adam

Sure, but we don’t support old versions of discourse. If you want to test this feature it’s not for the team to do for you.

I have added a fix for this, .eml files are not stripped from emails anymore

https://github.com/discourse/discourse/commit/1ac3e5473a5c7193138fedd507e5d2ae63d07d21