Solved

the specified string is not in the form required for an email address

Posted on 2009-05-16
4
707 Views
Last Modified: 2013-11-07
Hi folks,

I am getting the below error when sending the mail using smtp in asp.net 2.0 with c#.

Unhandled Exception: System.FormatException: The specified string is not in the form required for an e-mail address.
   at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName)
   at System.Net.Mail.MailAddress.ParseValue(String address)
   at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)
   at System.Net.Mail.MailAddress..ctor(String address, String displayName)
   at MailAddressDotted.Main(String[] args) in c:\Temp\2007-08\MailAddressDotted.cs:line 16

Please let the know solution of this problem.

Thanks in advance

Glenn
0
Comment
Question by:dotsandcoms
  • 2
4 Comments
 
LVL 14

Expert Comment

by:Dustin Hopkins
ID: 24402596
could you please provide any relevant code.

Hope this helps,
Dustin
0
 
LVL 12

Accepted Solution

by:
techExtreme earned 500 total points
ID: 24403748
Can you paste code from your file "MailAddressDotted.cs"  so that I can have a look at the code?
However, check that your 'mail From Address' and 'TO Address' have real email addresses.  for example you might have written address as "john" instead of "john@something.com"  .
0
 
LVL 12

Expert Comment

by:techExtreme
ID: 24411894
It is stated that the error was 'due to invalid email id.'. That same solution I have provided, so I think that should be the correct answer in my opinion. I have written that email address might be wrong like 'john' instead of 'john@something.com'.  So in a way my solution is correct, rest is upto the moderator. Thanks.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now