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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With