1

I am unable to add System.Net.Mail

Writing using System.Net.Mail give the error message - The namespace Mail does not exist in System.Net. Why it is searching it in System.Net when it is part of System dll

I have already added both System.Net and System references in my project

My purpose: I want to use MailAddress to validate email format. I don't need to send any mails. Just the format validation. For this System.Net.Mail must be added

Thank you

michael
  • 661
  • 1
  • 7
  • 18

2 Answers2

0

If you're writing client side code, Silverlight doesn't support the System.Net.Mail namespace.

Alternatively what you can do is just create a WCF service as follows.

Send e-Mail with Silverlight

Make use of regex to validate email address,

Regex to validate e-Mail address

Community
  • 1
  • 1
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • Thanks. That's why I am able to add System.Net.Mail in my test console application but not in the silverlight project. Can you please explain how else I can validate the email address format (should be simple). I'm new to coding. – michael Mar 25 '14 at 04:02
  • Do you know about regex? make use of this http://stackoverflow.com/questions/5342375/c-sharp-regex-email-validation – Sajeetharan Mar 25 '14 at 04:09
0

There is no System.Net.Mail class for Silverlight.You can use WCF service which handle the sending Mails.

Here is the good Example http://bronsblog.com/post/2011/07/05/Send-an-email-with-Silverlight-4.aspx

and http://www.silverlightnext.com/2010/06/send-email-from-silverlight-application.html