Link to home
Start Free TrialLog in
Avatar of solution1368
solution1368

asked on

asp.net, email, godaddy

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?

thanks

  public static string SendEmail(string from, string to, string subject, string body)
        {
            try
            {
                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("smtp01@test.com", "pwd");
                EmailClient.UseDefaultCredentials = false;
                EmailClient.Credentials = SMTPUserInfo;
                EmailClient.Send(MessageInfo);
                return "Send";
                //smtp01@evidiabio.com
                //Success@1368
            }
            catch
            {
                return "Unable to send email";
            }
        }
ASKER CERTIFIED SOLUTION
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points.  I hope you were able to resolve your problem!