smtp,, godaddy

I have web hosting on
and now I want to put the following codes
into another hosting server which is not in
Will the SMTP still work?

  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("", 25);
                System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("", "xxx");
                EmailClient.UseDefaultCredentials = false;
                EmailClient.Credentials = SMTPUserInfo;
                return "Send";
            catch (Exception e)
                return "Unable to send email<br>" + e.ToString() + "<br>";
Who is Participating?
GaryConnect With a Mentor Commented:
Not sure I understand what you mean
Normally you do not open mail servers to allow relaying - allows the possibility of your mail server being used to send spam..
No, it will only work in the GoDaddy environment.
You will have to set up your own mail server or use a generic one like GMail.
solution1368Author Commented:
hmmm.. okay.
assume I have my own server,
and I want to code reside on Will the SMTP still work?

SmtpClient EmailClient = new SmtpClient(, 25);
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.