Send-MailMessage : Unable to connect to remote server Line

Send-MailMessage -to “[email protected]” -from “[email protected]” -Subject “Subject Info” -Body “Content” -SmtpServer “Server Name”

Was not able to send mail from a Windows 2008 server and the error message displayed is as listed below:

Send-MailMessage : Unable to connect to the remote server
At line:1 char:17
+ Send-MailMessage <<<< -to [email protected] -from “[email protected]” -subject ” Troubleshooting” -Body “Some Text or file attachement” -sntpserver “smtpserver”
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.Send MailMessage

Found that the the block was in McAfee, when Powershell was excluded from McAfee. Send mail was success.

Steps to exclude Powershell in McAfee is listed below:

  1. Right click on McAfee icon.
  2. Click on Virus Scan Console.
  3. Double click on Access Protection on VirusScan Console.
  4. On Access Protection tab.
  5. Go to Anti-Virus Standard Protection.
  6. On right hand side, double click on Prevent mass mailing worms from sending mail.
  7. On process to exclude tab, add PowerShell.exe at the end.
  8. Click OK.
  9. Click apply on Access Protection.
  10. Click OK.

Thanks,
WintelAdmin

Facebook Comments
Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *