Thursday 28 January 2021

Send-MailMessage : Unable to send to all recipients

Issue Detail:

Was using the following powershell command to send the email from the IIS/SMTP relay

Send-MailMessage -From "nawaz@domain.com" -to "khan@domain.com" -Cc "ali@domain.com" -Subject "SUBJECT TEST with no cred" -Body "BODY Test for the email" -SmtpServer SMTPSERVERNAME -Credential USER -usessl

but was unable to do so, getting the following error.   

Error:

Send-MailMessage : Unable to send to all recipients

Solution:

Go to IIS and right click on your SMTP relay-->Properties-->Access tab-->Relay--->add the IP from where you are trying to send the emails

No comments:

Post a Comment