Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on MailboxAddress.TryParse #331

Closed
LeeBear35 opened this issue Aug 23, 2017 · 4 comments
Closed

Clarification on MailboxAddress.TryParse #331

LeeBear35 opened this issue Aug 23, 2017 · 4 comments
Labels
question A question about how to do something

Comments

@LeeBear35
Copy link

In some testing I confirmed that an address can have only the "local" part without the domain information, so it is not a valid Internet Address. My test:

  MimeKit.MailboxAddress mkMailBox = default(MimeKit.MailboxAddress);
  bool actual = MimeKit.MailboxAddress.TryParse("bounty", out mkMailBox);

  Console.WriteLine(mkMailBox);
  Console.WriteLine("Address {0}", mkMailBox.Address);
  Console.WriteLine("Name {0}", mkMailBox.Name);
  Assert.IsTrue(actual, string.Format("Extracted {0}", mkMailBox));

Results:
bounty
Address bounty
Name

I would have expected parsing would have returned False since the domain information is missing.

@jstedfast jstedfast added the question A question about how to do something label Aug 23, 2017
@jstedfast
Copy link
Owner

It's accepted because of historical use on Unix systems where you could send a message to a local user w/o specifying a domain.

You can override this behavior by using a ParserOptions with the AllowAddressWithoutDomains set to false.

http://www.mimekit.net/docs/html/P_MimeKit_ParserOptions_AllowAddressesWithoutDomain.htm

@nitinag
Copy link

nitinag commented Aug 23, 2017

You can also use just postmaster without a domain - SMTP RFC 5321

The reserved mailbox name "postmaster" may be used in a RCPT
command without domain qualification (see Section 4.1.1.3) and
MUST be accepted if so used.
https://tools.ietf.org/html/rfc5321#section-2.3.5

@EvanMulawski
Copy link

@jstedfast Even when specifying that parser option, it still returns true for addresses without a domain. Is this a bug (v2.0.1)?

image

@jjxtra
Copy link

jjxtra commented Feb 18, 2019

It's been a bug for over a year now, has not been fixed, not sure why this issue was closed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question about how to do something
Projects
None yet
Development

No branches or pull requests

5 participants