Harshal Thakre

Harshal Thakre

  • 1.5k
  • 235
  • 77.4k

How to send email from my c# website using godaddy mail

Jul 4 2014 7:33 AM
I have one year web hosting with email account from godaddy.
How Ican i config my website feedback ,or send any mail to third person from my website.
This is my code. 
StreamReader reader = new StreamReader(Server.MapPath("~/RegistrationEmailBody.htm"));
string readFile = reader.ReadToEnd();
string myString = "";
myString = readFile;
myString = myString.Replace("$$UserName$$", Username);
myString = myString.Replace("$$Password$$", password );
MailMessage Msg = new MailMessage();
MailAddress fromMail = new MailAddress("[email protected]");
// Sender e-mail address.
Msg.From = fromMail;
// Recipient e-mail address.
Msg.To.Add(new MailAddress(UserEmailId));
// Subject of e-mail
Msg.Subject = "OES Infotech Online Examination User Credential";
Msg.Body = myString.ToString();
Msg.IsBodyHtml = true;
SmtpClient mailClient = new SmtpClient("hosting.secureserver.net", 80);
// Change your gmail user id and password for send email
NetworkCredential NetCrd = new NetworkCredential("[email protected]", "abcd");
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = NetCrd;
mailClient.EnableSsl = true;
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mailClient.Send(Msg);
Plz Help me
 

Answers (3)