Powershell Send-MailMessage gives Mailbox unavailable. Error 5.7.60 on windows server 2016

2.5k views Asked by At

I am trying to send an email from powershell on windows server 2016 with the code below but get an error.

Send-MailMessage -From '[email protected]' `
-To '[email protected]`
-Subject 'Test mail' -SmtpServer smtp5.domain.com `
-Body 'this is a test'

Mailbox unavailable. The server response was: 5.7.60 SMTP; Client does not have permissions to send as this sender At line:1 char:1

1 -Before I even executed the code on the server I run it on my PC with no issues.

2 - I run it on a different windows server 2016 environment and I had no issue either.

3 - I thought the issue might be TLS/SSL, so i compared protocols between the two windows server 2016 environment and both use SSL 2.0.

3 - As per another question, I run below on the first line of my code and it still gave me an error.

[System.Net.ServicePointManager]::SecurityProtocol = 'Tls,TLS11,TLS12'

4 - all the troubleshooting guides online has got me no where either.

1

There are 1 answers

1
RichMath On

Check the SMTP protocol log on the SMTP server you're using. Is the connection authenticated or anonymous?

Check the mailbox that uses the '[email protected]' address. Does it accept mail from anonymous connections? Does it accept connections from only some senders?

If the connection is authenticated, is the account used in your script assigned the "Send As" right on the recipient's mailbox?