You can send the mail using godaddy hosting acocount using .NET 2.0 System.Net.Mail code namespace. Here is a simple snippet of how to send an email message from “[email protected]” to multiple email recipients It uses the godaddy smtp server.(note that the To a CC properties are collections and so can handle multiple address targets):
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 from web.config file, Here is an example of how to configure it:
<system.net>
<mailSettings>
<smtp from=”[email protected]“>
<network host=”pop.secureserver.net” port=”25″ userName=”username” password=”secret” defaultCredentials=”true” />
</smtp>
</mailSettings>
</system.net>
If you are using godaddy hosting then you need to use pop.secureserver.net as host and give the valid email id and password in web.config’s mailsettings as mentioned above.
Hope this helps, Enjoy Coding 🙂
Similar Topics:
- Asp.net sending email with zip file as attachment
- Outlook Web Access corrupts HTML attachments
- Asp.net file compression using opensource library
- WCF Interview Questions and Answers
- SQL CE standalone database
- Concept of OOPS in C#
- Singleton pattern – Design pattern
- ASP.NET Page Life Cycle explained
- Clickone Deployment installation location
- ASP.net Entityframework POCO Model