Here is one way of fixing an SMTP error on Windows Server 2012 when you see an error message similar to the one below:
Error Message
System.Exception: SMTP error sending: Client Service Setup Error on SERVERNAME ---> System.Web.HttpException: The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for user@itnota.com ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for user@itnota.com --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at ClientServiceSetup.CommonFunctions.SendMail(MailMessage objMail) --- End of inner exception stack trace ---
Steps to Add Localhost to the SMTP Relay
Launch IIS 6.0 Manager.
Right-click on the STMP Server (on this example it’s named default, but it could be named something else) and select Properties.
Click on the Access tab and at the very bottom under Relay restrictions, click on Relay button.
Select Only the list below, click on Add… button and under Single computer and IP Address, type in 127.0.0.1 and click OK.
Check Allow all computers which successfully authenticate to relay, regardless of the list above. and click OK, and OK one more time to get out the Properties window.
Re-test and that should be it.
Further Reading
IIS SMTP – The server response was: 5.7.1 Unable to relay for outgoing address, Still not working
How to Install SMTP Server on Windows Server 2012 R2
Leave a Reply