How to Send a Test Email Notification Using PowerShell
Purpose
This article documents a method for sending a simple email via PowerShell.
Use Case
Email notifications are failing to be sent by Veeam Backup & Replication, and there is a need to test the capability to send emails outside of Veeam Backup & Replication from the Veeam Backup Server.
Solution
Update and run the following PowerShell script on the Veeam Backup Server to simulate sending an email in a manner similar to the way Veeam Backup & Replication sends a notification email when using an SMTP server (Basic Authentication).
Notes:
- When the command is executed, a pop-up requesting the SMTP credentials will appear.
If credentials are not required, remove this paramter from the command: -Credential (Get-Credential)
- The following values must be updated in the command above:
- <FromEmail>
- <ToEmail>
- <smtp_server>
- <port>
Send-MailMessage -From alerts@domain.tld -To backupadmin@domain.tld -Subject "Veeam Powershell Email Test" -Body "Testing the SMTP service from PowerShell" -SmtpServer smtprelay.domain.tld -Port 25
- Remove -UseSsl if SSL is not enabled in the Veeam Backup & Replication Email Notification settings.
More Information
The Veeam PowerShell cmdlet Get-VBRMailNotificationConfiguration can be used to pull the current email settings from Veeam Backup & Replication.
To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.