It is not possible to specify an email notification recipients only in the Bcc field, the To field must also be populated. To send the notifications, use the below script. In the script:
- $to - Specifies the recipient's e-mail address.
- $subject - Specifies the subject of the email.
- $textBody - Specifies the body of the email.
- $from - Specifies the address from which the email will be sent.
- $bcc - Specifies a list of comma separated email addresses that receive a copy of the mail but are not listed as recipients of the message.
# Email settings
$to = "email@example.com" # TODO: modify me
$subject = "email" # TODO: modify me
$textBody = "Information" # TODO: modify me
$from = "firstname.lastname@example.org" # TODO: modify me
$bcc = "email@example.com" # TODO: modify me
# Bind to the 'ServiceSettings' container
$wellknownContainerPath = $Context.GetWellKnownContainerPath("ServiceSettings")
$serviceSettings = $Context.BindToObject($wellknownContainerPath)
# Send mail
$serviceSettings.MailSettings.SendMail($to, $subject, $textBody, $NULL, $from, $NULL, $bcc)
To run the script in your Scheduled Task, use the Run a program or PowerShell script action. Finally, the task will look like the following: