2
votes

I'm capable of building an .eml file using TIdMessage in Delphi.

It has a header like this:

X-Unsent: 1
Subject: Testiing Subject
To: "[email protected]" <[email protected]>
MIME-Version: 1.0
Date: Tue, 6 Oct 2020 15:43:50 -0300
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

But when I open the file (with ShellExecute() via Delphi code, or the file itself) using Outlook and Thunderbird, both open it like a received e-mail and don't show options to send the message.

From what I know, and found searching the Web, the X-Unsent:1 header should do the trick.

So my question is, does this flag not work anymore? If not, what should I try?

1
I can't speak for Outlook, but for Thunderbird see Bug #166541: Add support for X-Unsent property in .eml files and the X-Unsent support add-on.Remy Lebeau
Outlook respects the X-Unsent: 1, I just tried it with the header above and Outlook opened it in the edit mode.Dmitry Streblechenko
The X-Unsent add-on doens't work with the recent versions of ThunderBird wich is a pitty. The Outlook was my mistake I actually used the Email App of the Windows 10 in an Outlook Account and It didn't work. But when I saw your comment I tried in the Outlook App and it worked wich is a good news. Thanks a lot for your helpDiego_F

1 Answers

0
votes

Yes, as of late 2021, on Windows 10, Microsoft Outlook from the 365 apps edition (v16) is still responding as expected to the X-Unsent: 1 header. I just tested this with a quick and dirty ".EML" file generated in PowerShell with something like this:

@"
X-Unsent: 1
From: $sender
To: $recipient_list
Subject: $email_subject
MIME-Version: 1.0
Content-Type: text/plain

$message_body
"@ |out-file -filepath "${MailPath}\${filename}.eml" -encoding utf8

Good info and original answer in the comments for the question, but I thought this could benefit from being marked as answered and a little update and confirmation.

One last side note: I had the best results when the EML file was UNIX-style "LF-only" newlines, instead of "Windows style" CR-LF.