Add-EmailTemplateContacts

Prev Next

Summary

Creates a new email template contact.

Add-EmailTemplateContacts
    -Entry

Returns an email template contact object.

Parameters

Parameter

Type

Required?

Notes

Entry

Email Template Contact Object

Yes

The list of email template contact objects to create as a new entries.

Examples

Create a new email template contact

# Create a list of email template contact recipients that will be linked to an email template
# The contacts must already exist prior to adding them
$emailTemplateContacts = @(
  @{
    EmailTemplateId = 9
    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 template contact object to the Add-EmailTemplateContacts command to create the entries
$createdEmailTemplateContacts = Add-EmailTemplateContacts -Entries $emailTemplateContacts

# Use Write-Output to log the execution results
Write-Output "Linked $($createdEmailTemplateContacts.Inserts) contact(s) to email template 9"

Execution results:

Linked 1 contact(s) to email template 9