I'm a developer trying to get my .Net application to send emails out through our Exchange server. I'm not an Exchange expert so I'll qualify that up front!!
We've set up a receive
Connector in Exchange that has the following properties:
Network: allows all IP addresses via port 25.
Authentication: Transport Layer Security and Externally Secured checkboxes are checked.
Permission Groups: Anonymous Users and Exchange Servers checkboxes are checked.
But, when I run this Powershell statement right on our Exchange server it works when I send to a local domain address but when I try to send to a remote domain it fails.
WORKS:
C:\Windows\system32Send-Mailmessage -To
[email protected] -From
[email protected] -Subject testing -Body testing -SmtpServer OURSERVER
(BTW: my value for OURSERVER=boxname.domainname.local. This is the same fully-qualified name that shows up in our Exchange Management Shell when I launch it).
FAILS:
C:\Windows\system32Send-Mailmessage -To
[email protected] -From
[email protected] -Subject testing -Body testing -SmtpServer OURSERVER
Send-MailMessage : Mailbox unavailable. The server response was: 5.7.1 Unable to relay
At line:1 char:17
+ Send-Mailmessage <<<< -To
[email protected] -From
[email protected] -Subject testing -Body himom -SmtpServer FTI-EX
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpFailed
RecipientException
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
EDIT:
From @TheCleaner 's advice, I ran the Add-ADPermission to the relay and it didn't help;
[PS] C:\Windows\system32Get-ReceiveConnector "Allowed Relay" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -E
xtendedRights "Ms-Exch-SMTP-Accept-Any-Recipient"
Identity User Deny Inherited
-------- ---- ---- ---------
FTI-EX\Allowed Relay NT AUTHORITY\ANON... False False
Thanks for the help.
Mark