Asp.net-mvc – GoDaddy Send Email

asp.netasp.net-4.0asp.net-mvcasp.net-mvc-3email

I am using ASP.Net 4.0 with MVC 3 and C# to try and send an email from my site. This code works on other hosts but for some reason GoDaddy is erroring out. Here is the code I am using.

  var fAddress = new MailAddress("customers@email.com");
  var tAddress = new MailAddress("mygodaddyaddress@email.com");
  var message = new MailMessage(fAddress, tAddress)
  {
      Subject = subject,
      Body = body
  };

  var client = new SmtpClient("relay-hosting.secureserver.net");
  client.Send(message);

Here is the error I am receiving

Mailbox name not allowed. The server response was: sorry, your mail was administratively denied. (#5.7.1)

Any other GoDaddy users here that can shed some light?

Best Answer

It might be something to do with the from address:

Problem seem to be the FROM email address. The FROM email address must be an email address with the hosted domain to avoid this error. For example if you have a hosted domain yourdomain.com, your FROM email address should be something like username@yourdomain.com.

Source:
http://www.cosmocentral.com/2009/01/553-sorry-your-mail-was-administratively-denied/