Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Personalizations


When sending an email with the v3 Mail Send endpoint, you define the various metadata about your message, such as the recipients, sender, subject, and send time, at the root level of a JSON request body. Personalizations allow you to override these various metadata for each email in an API request.

Personalizations is an array of objects. Think of the personalizations array like the envelope of a letter: the fields defined within personalizations apply to each email, not the recipient. Like an envelope, personalizations are used to identify who should receive the email as well as details about how you would like the email to be handled. For example, you can define when you would like it to be sent, what headers you would like to include, and any substitutions or custom arguments you would like to be included with the email.

Personalizations allow you to define:

  • "to", "cc", "bcc" - The recipients of your email.
  • "from" - The sender or return path address of your email.
  • "subject" - The subject of your email.
  • "headers" - Any headers you would like to include in your email.
  • "substitutions" - Any substitutions you would like to be made for your email.
  • "custom_args" - Any custom arguments you would like to include in your email.
  • "send_at" - A specific time that you would like your email to be sent.
(information)

Info

You must include at least one to object within the personalizations array.

Since the personalizations property is an array, you may include multiple objects allowing you to specify different handling instructions for different copies of your email. For example, you could send the same email to both john@example.com and jane@example.com but set each email to be delivered at different times.


_22
{
_22
"from": "sender@yourdomain.com",
_22
"template_id": "YOUR TEMPLATE ID",
_22
"personalizations": [
_22
{
_22
"to": [
_22
{
_22
"email": "john@example.com"
_22
}
_22
],
_22
"send_at": 1600188812
_22
},
_22
{
_22
"to": [
_22
{
_22
"email": "jane@example.com"
_22
}
_22
],
_22
"send_at": 1600275471
_22
}
_22
]
_22
}

(information)

Info

You may not include more than 1000 personalizations per API request. If you need to include more than 1000 personalizations, please divide these across multiple API requests.

Some properties can be defined both at the root level of the request body (message level) and at the personalizations level.

For example, the from, subject, headers, custom_arg, and send_at properties can all be defined at the message level or at the personalizations level. Individual fields within the personalizations array will override any message level properties that are defined outside of personalizations. For example, the email subject defined within personalizations will override the subject defined at the message level in the JSON payload.

Keys within objects such as custom_args will be merged. If any of the keys conflict, the keys in the personalizations object will replace the message level object's keys.

(information)

Info

All of the recipients in a single personalization object (specified in the to, cc, or bcc fields) will see the same email, as defined by the data in that personalization. Because of this, SendGrid does not allow duplicate email addresses among these three recipient arrays in a single personalization.


Personalization Examples

personalization-examples page anchor

Below are some examples of how you can use personalizations for various use cases.

Sending a single email to a single recipient

sending-a-single-email-to-a-single-recipient page anchor

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


_17
{
_17
"personalizations": [
_17
{
_17
"to": [
_17
{
_17
"email": "recipient1@example.com"
_17
}
_17
],
_17
"cc": [
_17
{
_17
"email": "recipient2@example.com"
_17
}
_17
],
_17
"subject": "YOUR SUBJECT LINE GOES HERE"
_17
}
_17
]
_17
}

Sending a single email to a single recipient with substitutions

sending-a-single-email-to-a-single-recipient-with-substitutions page anchor

The following example shows you what the personalization property would look like if you wanted to send a single email to a single recipient with substitutions.


_16
{
_16
"personalizations": [
_16
{
_16
"to": [
_16
{
_16
"email": "recipient@example.com"
_16
}
_16
],
_16
"substitutions": {
_16
"%fname%": "recipient",
_16
"%CustomerID%": "CUSTOMER ID GOES HERE"
_16
},
_16
"subject": "YOUR SUBJECT LINE GOES HERE"
_16
}
_16
]
_16
}

Sending a single email to a single recipient with a CC

sending-a-single-email-to-a-single-recipient-with-a-cc page anchor

The following example shows how to send one email to recipient1@example.com with a carbon copy sent to recipient2@example@com. Both emails will have the same headers.


_17
{
_17
"personalizations": [
_17
{
_17
"to": [
_17
{
_17
"email": "recipient1@example.com"
_17
}
_17
],
_17
"cc": [
_17
{
_17
"email": "recipient2@example.com"
_17
}
_17
],
_17
"subject": "YOUR SUBJECT LINE GOES HERE"
_17
}
_17
]
_17
}

Sending a single email to a single recipient with a CC and a BCC

sending-a-single-email-to-a-single-recipient-with-a-cc-and-a-bcc page anchor

The following example shows how to send one email to recipient1@example.com with a CC sent to recipient2@example.com and a BCC sent to recipient3@example.com.


_21
{
_21
"personalizations": [
_21
{
_21
"to": [
_21
{
_21
"email": "recipient1@example.com"
_21
}
_21
],
_21
"cc": [
_21
{
_21
"email": "recipient2@example.com"
_21
}
_21
],
_21
"bcc": [
_21
{
_21
"email": "recipient3@example.com"
_21
}
_21
]
_21
}
_21
]
_21
}

Sending the same email to multiple recipients

sending-the-same-email-to-multiple-recipients page anchor

The following shows how to send one email to three different recipients: recipient1@example.com, recipient2@example.com, and recipient3@example.com. These recipients will all be able to see each other on the email.


_18
{
_18
"personalizations": [
_18
{
_18
"to": [
_18
{
_18
"email": "recipient1@example.com"
_18
},
_18
{
_18
"email": "recipient2@example.com"
_18
},
_18
{
_18
"email": "recipient3@example.com"
_18
}
_18
],
_18
"subject": "YOUR SUBJECT LINE GOES HERE"
_18
}
_18
]
_18
}

Sending a single email to a single recipient with multiple CCs and BCCs

sending-a-single-email-to-a-single-recipient-with-multiple-ccs-and-bccs page anchor

The following shows what personalizations are required to send the same email to one recipient, with multiple CCs and BCCs.


_23
{
_23
"personalizations": [
_23
{
_23
"to": [
_23
{
_23
"email": "recipient1@example.com"
_23
}
_23
],
_23
"cc": [
_23
{
_23
"email": "recipient2@example.com"
_23
},
_23
{
_23
"email": "recipient3@example.com"
_23
},
_23
{
_23
"email": "recipient4@example.com"
_23
}
_23
],
_23
"subject": "YOUR SUBJECT LINE GOES HERE"
_23
}
_23
]
_23
}

Sending two different emails to two different groups of recipients

sending-two-different-emails-to-two-different-groups-of-recipients page anchor

The following shows how to send two different emails to two different groups of recipients.


_42
{
_42
"personalizations": [
_42
{
_42
"to": [
_42
{
_42
"email": "recipient1@example.com"
_42
}
_42
],
_42
"cc": [
_42
{
_42
"email": "recipient2@example.com"
_42
},
_42
{
_42
"email": "recipient3@example.com"
_42
},
_42
{
_42
"email": "recipient4@example.com"
_42
}
_42
],
_42
"subject": "YOUR SUBJECT LINE GOES HERE"
_42
},
_42
{
_42
"to": [
_42
{
_42
"email": "recipient5@example.com"
_42
}
_42
],
_42
"cc": [
_42
{
_42
"email": "recipient6@example.com"
_42
},
_42
{
_42
"email": "recipient7@example.com"
_42
},
_42
{
_42
"email": "recipient8@example.com"
_42
}
_42
],
_42
"subject": "YOUR SUBJECT LINE GOES HERE"
_42
}
_42
]
_42
}

Sending multiple emails from multiple senders to multiple recipients

sending-multiple-emails-from-multiple-senders-to-multiple-recipients page anchor

It is possible to specify multiple From addresses using personalizations. If a personalization object does not contain a from object, SendGrid will use the email address in the from object defined at the root level of the request body.

To successfully deliver email using multiple From addresses, the following conditions must be met.

  • A from object with an email property must be specified at the root level of the request body.
  • The domain of the from email property specified in any personalization must match the domain of the from email property specified at root level of the request body—SendGrid will reject requests if these domains do not match.

_27
// This is valid
_27
{
_27
"from": {
_27
"email": "support@example.com"
_27
},
_27
"personalizations": [
_27
{
_27
"from": {
_27
"email": "noreply@example.com"
_27
}
_27
}
_27
]
_27
}
_27
_27
// This is invalid
_27
{
_27
"from": {
_27
"email": "support@example.com"
_27
},
_27
"personalizations": [
_27
{
_27
"from": {
_27
"email": "noreply@differentexample.com"
_27
}
_27
}
_27
]
_27
}

The following shows how to send multiple emails using three different from addresses on the same domain.

(warning)

Warning

You must complete domain authentication to send email from multiple addresses. SendGrid will reject requests from a sending domain that has not been authenticated.


_40
{
_40
"from": {
_40
"email": "default@samedomain.com"
_40
},
_40
"personalizations": [
_40
{
_40
"subject": "YOUR SUBJECT LINE GOES HERE",
_40
"to": [
_40
{
_40
"email": "recipient1@example1.com"
_40
}
_40
],
_40
"from": {
_40
"email": "sender1@samedomain.com"
_40
}
_40
},
_40
{
_40
"subject": "YOUR SUBJECT LINE GOES HERE",
_40
"to": [
_40
{
_40
"email": "recipient2@example2.com"
_40
}
_40
],
_40
"from": {
_40
"email": "sender2@samedomain.com"
_40
}
_40
},
_40
{
_40
"subject": "YOUR SUBJECT LINE GOES HERE",
_40
"to": [
_40
{
_40
"email": "recipient3@example3.com"
_40
}
_40
],
_40
"from": {
_40
"email": "sender3@samedomain.com"
_40
}
_40
}
_40
]
_40
}


Rate this page: