Pages

Wednesday, January 18, 2012

Email sending problem on godaddy shared hosting server

Include below namespace

using System.Net;
using System.Net.Mail;
using System.Net.Configuration;

C# Code Here

string strFromEmail= "";
string strToEmail = "";
string strSubject= "";
string strBody= "";

MailMessage mailMessage = new MailMessage(strFromEmail, strToEmail, strSubject, strBody);
mailMessage.IsBodyHtml = true;

SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = "relay-hosting.secureserver.net";
smtpClient.Port = 25;
smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
smtpClient.Send(mailMessage);

Thanks

Shared Button