You could create a custom notification to execute this PowerShell script to send notifications with custom header data (see Line 53). Alternatively you could look into the PRTG ticket system.
##############################################################################
##
## Send-MailMessage
##
## From Windows PowerShell Cookbook (O'Reilly)
## by Lee Holmes (http://www.leeholmes.com/guide)
##
## Illustrate the techniques used to send an email in PowerShell.
## In version two, use the Send-MailMessage cmdlet.
##
## Example:
##
## PS >$body = @"
## >> Hi from another satisfied customer of The PowerShell Cookbook!
## >> "@
## >>
## PS >$to = "[email protected]"
## PS >$subject = "Thanks for all of the scripts."
## PS >$mailHost = "mail.leeholmes.com"
## PS >Send-MailMessage $to $subject $body $mailHost
##
##############################################################################
param(
## The recipient of the mail message
[string[]] $To = $(throw "Please specify the destination mail address"),
## The subjecty of the message
[string] $Subject = "<No Subject>",
## The body of the message
[string] $Body = $(throw "Please specify the message content"),
## The SMTP host that will transmit the message
[string] $SmtpHost = $(throw "Please specify a mail server."),
## The sender of the message
[string] $From = "$($env:UserName)@example.com"
)
## Create the mail message
$email = New-Object System.Net.Mail.MailMessage
## Populate its fields
foreach($mailTo in $to)
{
$email.To.Add($mailTo)
}
$email.From = $from
$email.Subject = $subject
$email.Body = [string]::Format("{0}",$body);
$email.Headers.Add("X-Company", "My Company");
## Send the mail
$client = New-Object System.Net.Mail.SmtpClient $smtpHost
$client.UseDefaultCredentials = $true
$client.Send($email)
The script has to be called with the following parameters:
.\mail.ps1 [email protected] "My Subject" "Hello World" my.mailserver.com [email protected]
Add comment