+1 vote

I get following error:

System.ArgumentException: 'lise@enka.k12' is not a valid email address.

Parameter name: address at Limilabs.Mail.Headers.MailBox..ctor(String address, String name) at InboxSender.Gonderim.Islem(Object KanalID)

by

1 Answer

0 votes
 
Best answer

How does your code look like?

There are 2 problems with this address ('lise@enka.k12')
- if it has apostrophes - it is not a correct email address,
- k12 is not a valid top-domain name

You can skip the validation using MailBox.CreateWithoutValidation method:

MailBox m1 = MailBox.CreateWithoutValidation("lise@enka.k12");
MailBox m2 = MailBox.CreateWithoutValidation("lise@enka.k12", "Lise");

However this address is incorrect and does not exist - your email won't be delivered.

Just to be clear - this exception happens only when you create new MailBox, validation is not used when an email is parsed.

by (297k points)
...