Created: Last updated:
Some error messages are just plain annoying nonsense. This one is a perfect example and can be found when you send an email with SMTP:
- sorry, your mail was administratively denied. (#5.7.1)
It appears as if this is the default error message from an application and does not exclusively apply to the web hosting company like in my case, GoDaddy.
One important thing first. This error comes from a mail server, i.e. this is not about your local application like an email client (Outlook, Thunderbird, Gmail etc). It also does not come from your daemons like mailx or libraries like Zend_Mail. They simply funnel this error response they get back to you.
So, while this error message might be actually useful for an administrator of the SMTP server it just rings through to their helpless clients.
Whatever the reason, following is an explanation why the error actually shows up.
I ran into this problem because GoDaddy has some weird and special SMTP relay setup. So special that their support is incapable creating documents that show up either in their knowledge base or in Google at the top of the list. Furthermore and for some weird reason they are not interessed in clearly communicating the proper setup. At least, I have not found it where you think it should be.
Depending on where you are sending an email from you have to use a different relay agent. If you have a web application hosted with GoDaddy and wish to send an email from your application you have to use the internal relay.
You cannot use the external relay from your application. You may know the external relay for your email client. If you attempt to use the external relay with your hosted application you will get a "Connection time out" error.
We can only speculate why but I think they simply don't have a routing from the internal network to their outside smtp relay address. It beats me why not. It would be so much easier with one address and setup especially when you test from your external network; see why later below.
Anywho! From your hosted web application you have to use their internal relay SMTP agent as follows:
- SMTP Server: relay-hosting.secureserver.net
- Note: This internal relay does not require a username and password
There is a tiny little problem, though.
Lets say you have a form and once the user hits the submit button in your form you want to send an email to some email inbox. Because this is not just some info email message you may want the user's email address from the form as the sender. With that you could easily hit the reply button in your email client and send your answer to the request.
That's when you will run into the error above: your email gets administratively denied. For an unknown and paranoid reason they still expect that the sender address in the email head is an account that matches one of your GoDaddy email domains.
You cannot use the user's email address to send an email despite the fact that you cannot use the relay form outside their network and they will always know who you are—even without a username and password.
Use Reply-To instead
So here's how you can fix that. First, make sure you use one of your GoDaddy email accounts as the sender in the email head. Second, you can use the user's email address but you have set it in the Reply-To field. With the user's email address in that field you can still hit the reply button when you receive the email and respond to the request.
If you want to test your web application on a server in your network you have to use a different configuration. If you use this internal relay configuration for sending emails from your private network you will face another problem. If you use the internal relay address from your private network you will face the following error:
- unimplemented (#5.5.1)
Because setting up the external relay has a similar problem I have a separate document. The config and potential problem with that error message is in the document titled Envelope sender in badmailfrom list.