--- title: "Add-EmailMessage" slug: "scripting-add-emailmessage" updated: 2025-07-16T20:23:15Z published: 2025-07-16T20:23:15Z canonical: "help.agilityblue.com/scripting-add-emailmessage" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.agilityblue.com/llms.txt > Use this file to discover all available pages before exploring further. # Add-EmailMessage ## Summary Creates a new email message object. ```powershell Add-EmailMessage -Entry ``` Returns an [email message](https://apidocs.agilityblue.com/#47ed2fff-291a-4746-bc0c-6f88212e6c99) object. ## Parameters | Parameter | Type | Required? | Notes | | --- | --- | --- | --- | | Entry | [Email message](https://apidocs.agilityblue.com/#47ed2fff-291a-4746-bc0c-6f88212e6c99) object | Yes | The email message object to create as a new entry. | ## Examples > [!NOTE] > 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](/v1/docs/scripting-tutorials-concepts-task-emails) for a more detailed guide of this process. ### Create a new Email Message ```powershell # 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 = "
This is an email created from a script.
It accepts html that email clients allow.
" } # 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: ```plaintext Email message 59 (Email was created from a script) created ```