Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this page
Looking for more inspiration?Visit the

Personalizations


When you send an email message using the Mail Send v3 endpoint, you define properties about the email message: who sends it (from), who receives it (to), and what the message concerns (subject). The common name for these properties is metadata. If you want to send one email message to multiple recipients, you can customize the message sent to each recipient using Personalizations.

Write personalizations as an array of JSON objects in the API request body. The personalizations array works like the envelope of a letter: the properties you define within personalizations apply to the email message sent to the recipient. Like an envelope, personalizations identify who should receive the email and how Twilio should handle the email message. Each personalization object applies to one recipient, set with the to property.

(information)

Personalizations limit

Each API request has a limit of 1,000 personalization objects. To include more than 1,000, divide the objects across multiple API requests.

Personalizations differ from Substitutions, which customize the content of an email message. Personalizations can include Substitutions, but Substitutions don't contain Personalizations.


Personalization object properties

personalization-object-properties page anchor

In the personalizations array, you can customize one or more of the following properties for your email messages:

PropertyNecessityPurpose
toRequiredOne or more intended addressed recipients displayed in your message.
ccOptionalThe additional recipients of your message displayed to the intended recipient.
bccOptionalThe additional recipients of your message hidden from the intended recipient.
fromOptionalThe email address displayed as the sender of your message.
subjectOptionalThe subject line that your message displays.
headersOptionalAny email metadata headers your message should include.
substitutionsOptionalAny message body substitution text your message should include.
custom_argsOptionalAny unique custom metadata your message should include.
send_atOptionalThe specific time that your message sends expressed in UNIX Epoch time(link takes you to an external page).

Personalization array syntax

personalization-array-syntax page anchor

Within the personalizations array, you define handling instructions for different recipients of your email message.

  • Some properties you can define for each email message and each recipient.
    • Message-level properties are defined at the root level of the request body.
    • Recipient-level properties are defined in the personalizations array.
    • These properties include from, subject, headers, custom_args, and send_at.
  • Individual properties within the personalizations array override any message-level properties defined outside of personalizations.
  • Keys within objects such as custom_args get merged. If any of the keys conflict, the personalizations object keys override the message-level object keys.
  • You can't repeat email addresses in any of the to, cc, or bcc properties within the same personalizations array.
  • Each object in the personalizations array limits its substitutions object to 150 properties.
(information)

Example: Send messages at different times to different recipients

To send the same email to both john@example.com and jane@example.com but set each email to be delivered at different times.

1
{
2
"from": "sender@example.com",
3
"template_id": "YOUR TEMPLATE ID",
4
"personalizations": [{
5
"to": [{
6
"email": "john@example.com"
7
}],
8
"send_at": 1600188812
9
},
10
{
11
"to": [{
12
"email": "jane@example.com"
13
}],
14
"send_at": 1600275471
15
}]
16
}

Personalization examples

personalization-examples page anchor

The following examples show how to use personalizations for common use cases. These use cases include sending to a single recipient, adding CC and BCC recipients, sending to multiple recipients, and sending from multiple senders.

Send one email to one recipient examples

send-one-email-to-one-recipient-examples page anchor
One recipientWith substitutionsWith one CCWith one CC and one BCC

The following example shows you what the personalization property would look like if you wanted to send one email to one recipient.

1
{
2
"personalizations": [{
3
"to": [{
4
"email": "recipient1@example.com"
5
}],
6
"cc": [{
7
"email": "recipient2@example.com"
8
}],
9
"subject": "YOUR SUBJECT LINE GOES HERE"
10
}]
11
}

Send email messages to many recipient examples

send-email-messages-to-many-recipient-examples page anchor
To many recipientsWith many CCs and BCCsTwo emails to two groups

To send one email to three different recipients, follow this example:

1
{
2
"personalizations": [{
3
"to": [{
4
"email": "recipient1@example.com"
5
},{
6
"email": "recipient2@example.com"
7
},{
8
"email": "recipient3@example.com"
9
}],
10
"subject": "YOUR SUBJECT LINE GOES HERE"
11
}]
12
}

All recipients can see all other recipients to the email.

Send email messages from many senders examples

send-email-messages-from-many-senders-examples page anchor

To send email messages from more than one sender, use personalizations.

  • Set a from.email property at the root level of the request body.
  • Add more from.email addresses in the personalizations array.
  • If a personalization object doesn't contain a from.email property, Twilio SendGrid uses the email address in the from.email property in the root level of the request body.
(warning)

Email address restrictions

Twilio SendGrid rejects requests from a sending domain under two conditions:

  • The domain of the from.email and personalizations.from.email don't match. All email messages must come from the same sending domain.
  • The sneding domain hasn't undergone domain authentication.

If these domains don't match or haven't been authenticated, Twilio SendGrid rejects the request.

To many recipientsMany emails to many recipients

To send email messages using multiple From addresses, following this example:

1
// This is valid
2
{
3
"from": {
4
"email": "support@example.com"
5
},
6
"personalizations": [{
7
"from": {
8
"email": "noreply@example.com"
9
}
10
}]
11
}
1
// This is invalid
2
{
3
"from": {
4
"email": "support@example.com"
5
},
6
"personalizations": [{
7
"from": {
8
"email": "noreply@differentexample.com"
9
}
10
}]
11
}