Email asp net Sending email using godaddy hosting account

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@website.com” 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@website.com");
 
message.To.Add(new MailAddress("recipient1@website.com"));
message.To.Add(new MailAddress("recipient2@website.com"));
message.To.Add(new MailAddress("recipient3@website.com"));
 
message.CC.Add(new MailAddress("carboncopy@website.com"));
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=”from@website.com“>
        <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:

Tags:

email godaddy com
We will send you more information on Email asp net Sending email using godaddy hosting account.
Enter your email address:
This entry was posted in .Net and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>