asp.net, email, godaddy
Posted on 2013-06-06
I need to send email by using GoDaddy.com hosting. and have two questions.
1. The following code does not work emailing. any idea why?
2. If the following codes are resided my house server(window 2008), will the smtp email still working? Or the codes have to reside in godaddy hosting?
public static string SendEmail(string from, string to, string subject, string body)
MailMessage MessageInfo = new MailMessage(from,to,subject,body);
MessageInfo.IsBodyHtml = true;
SmtpClient EmailClient = new SmtpClient("relay-hosting.secureserver.net");
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("firstname.lastname@example.org", "pwd");
EmailClient.UseDefaultCredentials = false;
EmailClient.Credentials = SMTPUserInfo;
return "Unable to send email";