Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email protected]

I am getting “Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email protected]” when I try to send the mail using ASP.NET. The site is deployed on IIS7, Windows 2008 server.

The website was working fine on IIS6 and Windows 2003 Server. I deployed it on IIS7, 2008 it has started giving me this error.

Has anybody experienced this before?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Aahh got it… I got it working 🙂

Thanks Christopher, your suggesion is correct.

But, finding “Default SMTP Virtual Server” was tricky 😉

Even if you use IIS7 to deploy your web site, you have to open IIS6 Manager to configure SMTP server (why?).

I configured SMTP server as follows to make things work:

  1. Open IIS6 Manager using Control Panel –> Administrative Tools.
  2. Open SMTP Virtual Server properties.
  3. On General tab, Set IP address of
    the Web server instead of “All
    Unassigned”.
  4. In Access tab, click on Relay
    button, this will open Relay
    Restrictions dialog.
  5. In relay computers list, add the
    loopback IP address i.e 127.0.0.1
    and IP address of the Web server, so that they can pass/relay emails through the SMTP server.

Method 2

herein lies the answer…
IIS Settings

IIS–>Default SMTP Virtual Server–>Properties–>Access–>Relay restrictions
just add or exclude the IPs you care about, should resolve the issue.

Method 3

I was facing the identical problem and followed the (very clearly spelled out) steps in Vinod’s reply, however this then created a different error:

Unable to read data from the transport connection: net_io_connectionclosed

I did a bit more digging and poking around and (while I’m not sure why this worked) I solved it by:
– Going back into IIS6.0 management console
– Open SMTP Virtual Server properties
– On General tab, changing the ‘IP Address:’ setting back to ‘(All Unassigned)’

Not sure why this works, but hopefully will help out someone facing the same problem in the future.

Method 4

As a picture is worth a thousand words..

When you find the IIS6 manager (I have found that searching for IIS may return 2 results) go to the SMTP server properties then ‘Access’ then press the relay button.

Then you can either select all or only allow certain ip’s like 127.0.0.1

SMTP Relay

Method 5

Thanks to Vinod for the well presented answer.

I got the same error as Mick Byrne when I followed the steps above. Turning it back to All Unassigned sorted it but I had to tweak a few other things as well:

  • Add the user my site was running under to the users on the Security Tab in SMTP Virtual Server.
  • Changed the value in the mailSettings > network > host attribute in my web.config to the specific server IP (for example 192.168.100.120) as opposed to localhost (which was pointing at 127.0.0.1 in the hosts file).

Hope this saves someone a few mins of messing about.

Method 6

I was able to fix this issue by changing the mail settings in the system.net portion of my web.config:

<mailSettings>
    <smtp deliveryMethod="Network">
        <network host="yourserver" defaultCredentials="true"/>
    </smtp>
</mailSettings>

Method 7

If you have Exchange 2010:

(In my case, the error message didn’t contain ” for [email protected]”)

This shows how to add a receive connector: http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010/

But I also needed to perform a step found here: http://recover-email.blogspot.com.au/2013/12/how-to-solve-exchange-smtp-server-error.html

  • Go to Exchange Management Shell and run the command
  • Get-ReceiveConnector “JiraTest” | Add-ADPermission -User “NT AUTHORITYANONYMOUS LOGON” -ExtendedRights
    “ms-Exch-SMTP-Accept-Any-Recipient”

While working on this, I ran the following on the affected server’s PowerShell console until the error went away:

Send-MailMessage -From "<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="274a5e424a464e4b675442555142550944484a094652">[email protected]</a>" -To "<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c5a8bca0a8a4aca985b6a0b7b3a0b7eba6aaa8eba4b0">[email protected]</a>" -Subject "Test Email" -Body "This is a test"

Method 8

Wanted to share what caused the error in my case. Spend couple hours to figure this out, so hopefully it will help to save someone some time.

Strangely enough, the error was raised with the Enable drop directory quota setting being enabled for the domain.

enter image description here

I am not the expert and don’t know the technical explanation, but unticking the mentioned setting sorted the problem.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x