Hi i need mail coding with Example so pls send me soon as possible
Thanks&Regs
Magesh
Mail coding?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
SenthilkumarRank #387 · 6.5K pointsPosted Mar 17, 2012, 12:43 AM EDT
The MailMessage comes under the namespace of System.Net.Mail.
Here is the sample code to send email.
MailMessage message = new MailMessage(); message.From = new MailAddress("[email protected]"); message.To.Add(new MailAddress("[email protected]")); message.To.Add(new MailAddress("[email protected]")); message.To.Add(new MailAddress("[email protected]")); message.CC.Add(new MailAddress("[email protected]")); message.Subject = "This is my subject"; message.Body = "This is the content"; SmtpClient client = new SmtpClient(); client.Send(message);System.Net.Mail reads SMTP configuration data out of the standard .NET configuration system (so for ASP.NET applications you'd configure this in your application's web.config file). Here is an example of how to configure it:
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="smtpserver1" port="25" userName="username" password="secret" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
Please go through this url. The MSDN has given the methods and properties of the MailMessage class with an code.
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx
magesh manavalanRank #7,614 · 236 pointsPosted Mar 17, 2012, 1:13 AM EDT
SenthilkumarRank #387 · 6.5K pointsPosted Mar 17, 2012, 6:47 AM EDT
Please post the error which you are getting...