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?
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 AUTHORITY\ANONYMOUS 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 "[email protected]" -To "[email protected]" -Subject "Test Email" -Body "This is a test"
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:
Hope this saves someone a few mins of messing about.
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.
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>
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.
I am not the expert and don't know the technical explanation, but unticking the mentioned setting sorted the problem.
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
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.
Source: Stackoverflow.com