We are using Mail.dll for an application which retrieves and stores e-mails locally for further processing from an Office 365 IMAP server.
This application runs for few months and we faced one minor issue.
Example EML File:
Date: Thu, 21 May 2025 08:00:00 +0000
Message-ID: <random-message-id>
Subject: Test Mail
Sender: MAILER-DAEMON <MAILER-DAEMON@LOCALHOST>
From: MAILER-DAEMON <MAILER-DAEMON@LOCALHOST>
To: Max Test <max@test.eu>
If we parse this EML via MailBuilder.CreateFromEmlFile()
or MailBuilder.CreateFromEml()
method, we get an IMail
object as expected and Sender/From fields with mail address set to "MAILER-DAEMON@LOCALHOST".
If we try to create a MailBox object via constructur
new MailBox("MAILER-DAEMON@LOCALHOST")
we get following exception:
System.ArgumentException:
'MAILER-DAEMON@LOCALHOST' is not a valid email address.
As a working solution, we already using following method now:
MailBox.CreateWithoutValidation("MAILER-DAEMON@LOCALHOST")
My colleagues would just need some clarification, as we didn't find this information in the manual/documentation or overseen it:
Is our assumption right, that for the MailBuilder.Create() methods no mail address validation happens in the first place?