How to export sent email as eml/msg file?

How can I export a complete email sent by discourse to a file (eml or msg format)?

Background of the question: We are having problems, that discourse invite emails are classified as spam by the receiving email server (of one email provider – for other email providers it works). To debug the issue, the email provider requested samples of the sent email as eml or msg files.

Thanks! Simon

Hi Simon :wave:

If you can retrieve an invite email in your spam folder, or another inbox in which the email wasn’t detected as spam, pretty much any email client has the option to download the message in one of these formats.

For example, in Gmail, it would be here to download the email in a .eml format:

You might try the logs of your email sending service.

1 Like

Thanks for your replies!

I’m aware of that, and did provide a sample that went through at another provider to the provider in question. But that support explicitly asked for a sample sent to them. :-/ I’m not in the position to discuss with them about the sense of that, but just want to fulfil their request…

@pfaffman can you elaborate a little, not sure if I get you right.
We use the “standard” installation with two docker containers (discourse, mail-in) and send via an SMTP connection using an email address of the provider in question to other email addresses of the provider in question. As the provider in question asks me for samples, the apparently cannot (or will not) find a sample on their system. Thus I’m looking for a way to export it from discourse. I can see the mail in the admin panel as “undeliverable”, but only see the incoming bounce message, not the email sent. Under “sent” I do see a row with the email, also showing the smtp details: 250 2.0.0 OK queued with id Z2869bz5GCbjCq9 but not the email details (header, body) or way to download/export it.

As it seems not to be possible, I’ll open a feature request: Feature request: export of sent email as file (eml or msg)

In order to be able to export sent emails, we would need to keep a copy.

I could see the value of a debug setting that logged all outgoing mail.

For now, you could point at a local postfix that spooled copies to another directory or bcc:ed them to you.

Thanks for you reply!

Yes. A simmilar setting to the already existing setting delete email logs after days would probably be sensible to prevent overflowing the disk by deleting the emails itself after n days as well.

While beyond my current competences, first approach seems doable to me as a workaround (with added work). For the second suggestion I would fear, that support would reject the email as the receiving mail server may have altered the email… :-/

When I needed to do this recently I got the message from mailgun. I imagine other services will let you do this too.

Well, we’re not using any “service”. Just SMTP to a regular mail account (~160 users; <20 post/day).

You have some SMTP server that is receiving and (maybe not) delivering the email. Do you not have access to those logs?

I think that you’d need a plugin or to hack the code inside the container to get it to write those messages to a file, maybe.

We are not “having”, just “using” the smtp server. :wink: It’s a mail server of an external provider (actually the same provider, who is declining the mails…). The mail server is indeed delivering the mail, only the receiving mail server (of the same provider) is declining the mail.
As it is the mail server of an external provider, we do not have access to the log files.

But I’m continuing back and forth with the support of them, hoping to come to a solution sometime soonish (it only took close to a month by now…).


The story continus… Now the support wants a copy of the bounce mail as eml or msg file. Thus my follow-up question: Is it possible to export an incoming email? Under E-Mail → Bounced I do see a list entry and can have a look at the email details (header fields, subject, mail body, …) but I do not see a possibility to download the message as a file. Am I overseeing anything, is there a different way?

Copy and paste the raw message (headers and body, all of it) into a text file. That’s the same thing.


Thanks for the info. I wasn’t sure about encoding and stuff (e.g. example of a mail source code out of my MTA: ...m=C3=BCssten wir auch noch mal 2 gro=C3=9Fe Switche...), if it would work the same.

You’ll notice a header in that message that says: Content-Transfer-Encoding: quoted-printable. That tells anything reading the message how to decode it.

There’s less magic in a .msg file than you might think :slight_smile:


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