Add-EmailMessageContacts
  • 1 Minute to read
  • Dark
    Light
  • PDF

Add-EmailMessageContacts

  • Dark
    Light
  • PDF

Article summary

Summary

Adds a list of contacts to an email message.

Add-EmailMessageContacts
    -Entries

Returns a bulk import results object.

Parameters

Parameter

Type

Required?

Notes

Entries

List of Email Message Contact objects

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.

Add email message contacts

# 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:

Linked 1 contact(s) to email message 59