Send mail from powershell

You can send an email from PowerShell using the Send-MailMessage cmdlet. Here's an example of how to use it:

Send-MailMessage -To "[email protected]" -From "[email protected]" -Subject "Test Email" -Body "This is a test email sent from PowerShell"

This will send an email to the recipient with the specified subject and body.

You can also specify additional parameters, such as:

Here's an example that includes some of these additional parameters:

Send-MailMessage -To "[email protected]" -From "[email protected]" -Subject "Test Email" -Body "This is a test email sent from PowerShell" -SmtpServer "smtp.example.com" -Attachments "C:\Path\To\File1.txt", "C:\Path\To\File2.pdf" -Priority High -Encoding UTF8

Note that you need to have the Send-MailMessage cmdlet installed and configured on your system. If you're running PowerShell on a Windows system, this cmdlet is included by default. If you're running PowerShell on a Linux or macOS system, you may need to install the Send-MailMessage cmdlet separately.

Also, make sure to replace the placeholders ([email protected], [email protected], smtp.example.com, etc.) with the actual values for your email account and server.