Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple '@' symbol in email address not working with .net 2005

Tags:

asp.net

In our application we send email to user of applications. When our user email address is like [email protected]@company, it fails with exception of system.net.mime.mailbnfhelper.readmailaddress

So can a email address have multiple '@' symbol and can .net MailMessege object handle it?

like image 489
jvm Avatar asked Dec 28 '22 22:12

jvm


2 Answers

No, that's not a valid e-mail address. See RFC-5322, section 3.4.1 and section 3.2.3 for the lists of characters allowed in each of the parts (the definition of the atoms).

In order to have multiple '@' symbols you need to use quoted strings. Apparently MailAddress does not support these (but does not document it). I'm running .NET 3.5 on a Win7 machine and MailAddress throws a FormatException when fed one of these.

like image 54
R. Martinho Fernandes Avatar answered Feb 20 '23 06:02

R. Martinho Fernandes


It is possible to have few @ signs, but you have to put other one in quotes.

like image 22
Marek Kwiendacz Avatar answered Feb 20 '23 05:02

Marek Kwiendacz