, email, godaddy

I need to send email by using 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("");
                System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("", "pwd");
                EmailClient.UseDefaultCredentials = false;
                EmailClient.Credentials = SMTPUserInfo;
                return "Send";
                return "Unable to send email";
Who is Participating?
Paul MacDonaldConnect With a Mentor Director, Information SystemsCommented:
You're in a TRY...CATCH - what's the error message being returned?  Use...
     catch (Exception e) get the exception.
Paul MacDonaldDirector, Information SystemsCommented:
Thanks for the points.  I hope you were able to resolve your problem!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.