Trying send email through godaddy hosting RRS feed

  • Question

  • User657157977 posted

    Split off from https://forums.asp.net/t/1373780.aspx?URGENT+Problem+in+trying+send+email+through+godaddy+hosting.

    I'm also facing the same issue ,if anybody knows the solution please let me know.


    I have found that the below code only work for Windows VPS in goddady.

    MailMessage msg = new MailMessage();
    msg.To.Add(new MailAddress(toEmailId));
    msg.From = new MailAddress("email@domain.com");
    msg.Subject = subject;
    msg.Body = message;
    msg.IsBodyHtml = true;

    SmtpClient client = new SmtpClient();
    client.Credentials = new NetworkCredential("email@domain.com", "password");
    client.Port = 25;
    client.Host = "hostname";

    For goddady Shared hosting Need to use the below mentioned code:

    In Web.config:

        <smtp from="your email address">
          <network host="relay-hosting.secureserver.net" port="25" />

    In controller:
    MailMessage message = new MailMessage();
    message.From = new MailAddress("your email address");

    message.To.Add(new MailAddress("your recipient"));

    message.Subject = "your subject";
    message.Body = "content of your email";

    SmtpClient client = new SmtpClient();
    Thursday, February 7, 2019 5:09 AM

All replies

  • User-351282504 posted

    Did you try port 587 instead of 25?  Most of ISPs will block port 25.

    Saturday, March 23, 2019 4:30 PM