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

8

85

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?

Throng answered 2/7, 2010 at 12:42 Comment(2)
possible duplicate of Mailbox unavailable. The server response was: 5.7.1 Unable to relay ErrorRambunctious
Stack Overflow is a site for programming and development questions. Use another site on the Stack Exchange network.Sigvard
T
117

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.
Throng answered 2/7, 2010 at 14:2 Comment(5)
The reason this needs to be managed in IIS 6 is because IIS 7.X doesn't have its own SMTP server component, so it uses IIS 6.Cube
In my web.config I was referring to my smtp server by the name "localhost". If I followed step 3, this solution failed; if I omitted step 3 it worked. Thanks :)Fluctuate
This also applies to IIS8 and server 2012Kovno
We are using a relay in order to send emails via an account in our Office 365. Do I still need to install the smtp server in IIS 6 even though we aren't using the web server's smtp server. This is on a Windows Server 2016 running IIS 10. Does anyone have any suggestions or a solution for this issue? Thank you in advance!Makowski
Thank you very much! Solved my problem.Feinleib
M
20

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.

Malapert answered 2/7, 2010 at 12:45 Comment(1)
where is "Default SMTP Virtual Server"? I am using IIS7. In IIS6 there is "SMTP Virtual Server" but in IIS& it is not?Throng
C
19

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.

Cuddle answered 9/3, 2011 at 12:52 Comment(0)
S
15

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

Sombrero answered 10/6, 2014 at 22:15 Comment(0)
O
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.

Outrush answered 21/2, 2012 at 10:58 Comment(0)
P
4

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>
Phinney answered 2/5, 2013 at 11:35 Comment(0)
C
2

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"
Crosswise answered 27/5, 2014 at 2:31 Comment(0)
I
1

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.

Immoral answered 25/1, 2017 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.