Closed vodoo777 closed 3 weeks ago
That's an invalid address.
The .
character must be between atom tokens. For example, john.doe@domain.com
is valid, but .doe@domain.com
and john.@domain.com
are not.
FWIW, you can enable Looser
rfc-compliance which I believe should work for these addresses like this:
var options = ParserOptions.Default.Clone ();
options.AddressParserComplianceMode = RfcComplianceMode.Looser;
if (MailboxAddress.TryParse (options, "john.@domain.com", out var mailbox))
mailbox.Name = "Name";
That's an invalid address.
The
.
character must be between atom tokens. For example,john.doe@domain.com
is valid, but.doe@domain.com
andjohn.@domain.com
are not.
I thought the same, but I investigated and found that addresses like john.@domain.com are valid. For example, you can send an email to an address like this, and the recipient will receive it. I tested it with my own email.
FWIW, you can enable
Looser
rfc-compliance which I believe should work for these addresses like this:var options = ParserOptions.Default.Clone (); options.AddressParserComplianceMode = RfcComplianceMode.Looser; if (MailboxAddress.TryParse (options, "john.@domain.com", out var mailbox)) mailbox.Name = "Name";
Thank you, I will try
I thought the same, but I investigated and found that addresses like john.@domain.com are valid. For example, you can send an email to an address like this, and the recipient will receive it. I tested it with my own email.
They might technically work, but according to official specifications, they are not legal.
Things like this sometimes work but it's usually because the mail server strips all .
's in the local-part of the address. GMail, for example, does this.
With GMail, john.doe@gmail.com
is the same as johndoe@gmail.com
for example.
I thought the same, but I investigated and found that addresses like john.@domain.com are valid. For example, you can send an email to an address like this, and the recipient will receive it. I tested it with my own email.
They might technically work, but according to official specifications, they are not legal.
Things like this sometimes work but it's usually because the mail server strips all
.
's in the local-part of the address. GMail, for example, does this.With GMail,
john.doe@gmail.com
is the same asjohndoe@gmail.com
for example.
Got it, thank you for the explanation!
If the email address contains a dot before the '@' symbol (e.g., john.@domain.com), the error 'Invalid local-part at offset 0' occurs.
Steps to reproduce the behavior: Execute the code: new MailboxAddress(Encoding.UTF8, "Name", " john.@domain.com")
Expected behavior This error should not be raised because email addresses with a dot before the '@' symbol are valid