Jump to content

Sendmail via Powershell


Christian Kiesel

Recommended Posts

I have added a powershel script to Pulseway and scheduled it.

On the Server the script is running well, but with Pulseway it has a problem to send a mail with the PS command: Send-MailMessage.

+          Send-MailMessage -To $user.EmailAddress -BCC $MailSender -Fr ...
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.Mail.SmtpClient:Sm 
   tpClient) [Send-MailMessage], SmtpException
    + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.Send 
   MailMessage

The command is: Send-MailMessage -To $user.EmailAddress  -From $MailSender -SmtpServer $SMTPServer -Subject $Subject -Body $EmailBody

 

What is the reason for the error ??

 

I use this script:

https://4sysops.com/archives/a-password-expiration-reminder-script-in-powershell/

 

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...