--- title: "Add-EmailMessageContacts" slug: "scripting-add-emailmessagecontacts" updated: 2025-07-16T20:28:23Z published: 2025-07-16T20:28:23Z canonical: "help.agilityblue.com/scripting-add-emailmessagecontacts" --- > ## 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-EmailMessageContacts ## Summary Adds a list of contacts to an email message. ```powershell Add-EmailMessageContacts    -Entries ``` Returns a bulk import results object. ## Parameters | Parameter | Type | Required? | Notes | | --- | --- | --- | --- | | Entries | List of [Email Message Contact](https://apidocs.agilityblue.com/#e8ca028d-fa73-47b9-82c9-4a1bf6f50278) objects | Yes | The list of email message contact objects to create as a new entries. | ## 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. ### Add email message contacts ```powershell # Create a list of email message contact recipients that will be linked to an email message # The contacts must already exist prior to adding them $emailMessageContacts = @(  @{    EmailMessageId = 59    ContactId = 1    RelationshipTypeId = 1  } ) <# Use the following table to determine what RelationshipTypeId to use for your contact: Relationship    Id --------------  ---- To              1 Cc              3 Bcc             4 --------------  ---- #> # Pass the email message contact object to the Add-EmailMessageContacts command to create the entries $createdEmailMessageContacts = Add-EmailMessageContacts -Entries $emailMessageContacts # Use Write-Output to log the execution results Write-Output "Linked $($createdEmailMessageContacts.Inserts) contact(s) to email message 59" ``` Execution results: ```plaintext Linked 1 contact(s) to email message 59 ```