Cannot send email in ASP.NET through Godaddy servers

Jared picture Jared · Sep 1, 2009 · Viewed 19.9k times · Source

I have an ASP.NET application hosted on Godaddy that I want to send email from. When it runs, I get: Mailbox name not allowed. The server response was: sorry, relaying denied from your location. The important parts of the code and Web.config are below:

msg = new MailMessage("[email protected]", email);
        msg.Subject = "GreekTools Registration";
        msg.Body =
            "You have been invited by your organization to register for the GreekTools recruitment application.<br/><br/>" +
            url + "<br/><br/>" +
            "Sincerely,<br/>" +
            "The GreekTools Team";

        msg.IsBodyHtml = true;

        client = new SmtpClient();
        client.Host = "relay-hosting.secureserver.net";

        client.Send(msg);

<system.net>
<mailSettings>
  <smtp from="[email protected]">
    <network host="relay-hosting.secureserver.net" port="25" userName="********" password="*********" />
  </smtp>
</mailSettings>

Answer

Ozan BAYRAM picture Ozan BAYRAM · Jan 4, 2011

1- If your site is hosted on godaddy you may use "relay-hosting.secureserver.net" without credentials.

2- If your site is hosted outside of godaddy you may use "smtpout.secureserver.net" with you email account credentials.

PS: Please change port 3535 if you have problems with 25

Hosted On GoDaddy

    <system.net>
      <mailSettings>
       <smtp from="[email protected]">
        <network host="relay-hosting.secureserver.net"/>
       </smtp>
      </mailSettings>
    </system.net>

External

  <system.net>
    <mailSettings>
      <smtp from="[email protected]">
        <network host="smtpout.secureserver.net" 
           userName="[email protected]" password="your_password_here" 
           port="25" />
      </smtp>
    </mailSettings>
  </system.net>