Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi. VB Net 2008
Im using System.Net.mail (version 3.5.0.0 of System.Net) to send emails.

We have a perfectly valid email address in the format name.@outlook.com
(Note the period before the @) but when adding the email address using
mymailmessage.To.Add("name.@outlook.com") we get the following error :

"The specified string is not in the form required for an e-mail address"

and therefore we are unable to send an email to this client in code.

Any ideas on how to resolve this issue?

What I have tried:

We have tested the email address manually via mail clients (outlook, thunderbird) and the client receives emails perfectly.
Posted

Hi,

The reason you are receiving an exception is because the email address format is NOT valid.

Have a look at:
Email address - Wikipedia, the free encyclopedia[^]

Local part:
Character . (dot, period, full stop), ASCII 46, provided that it is not the first or last character, and provided also that it does not appear consecutively

I'm not sure how your mail clients are able to send to this address.

... hope it helps.
 
Share this answer
 
This bug seems to have been fixed somewhere between versions 4.0 and 4.6 of the framework. The following code fails in .NET 3.5, but works as expected in 4.6 on my machine:
C#
var address = new MailAddress("name.@outlook.com");

If you need to support this type of address, it seems your only option is to upgrade to a more recent version of the .NET Framework.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900