Add-EmailMessage
- 1 Minute to read
- Print
- DarkLight
- PDF
Add-EmailMessage
- 1 Minute to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Summary
Creates a new email message object.
Add-EmailMessage
-Entry
Returns an email message object.
Parameters
Parameter | Type | Required? | Notes |
---|---|---|---|
Entry | Email Message Object | Yes |
Examples
Note
Creating and sending emails from Agility Blue requires that you first create an email message, associate recipient contacts to the email, link the email to an existing task, and then issue a command to send the email. See the task emails concepts article for a more detailed guide of this process.
Create a new Email Message
# Create an email message
$emailMessage = @{
To = "someone1@somewhere.com; someone2@somewhere.com"
FromAddress = "someone@somewhere.com"
FromName = "Someone's Name"
Subject = "Email was created from a script"
Body = "<p>This is an email created from a script.</p><p>It accepts html that email clients allow.</p>"
}
# Pass the email message object to the Add-EmailMessage command to create the entry
$createdEmailMessage = Add-EmailMessage -Entry $emailMessage
# Use Write-Output to log the execution results
Write-Output "Email message $($createdEmailMessage.EmailMessageId) ($($createdEmailMessage.Subject)) created"
Execution results:
Email message 59 (Email was created from a script) created