Generate Personalized SendGrid Email Campaigns

Use query string URL to create a personalized email header in SendGrid

Personalized email feels more personal and engaging to users. It builds trust between you and the user.

In this guide we will utilize query string URL to generate image with our intended recipient's name in the email header image. The link can then be embedded in the email.


Our design will look like this. You can find this template in our list of preset templates.


Query string URL is the easiest integrations to use and it should take less than 5 minutes to everything up.

1. Setting up our query string

For this template, we are only interested in customizing the recipient name.

We create a query string called name that maps to our template's object user (field text).

We also set the allowed origins to *. This allows the image to be requested from any origins. For more information about query string, please read the documentation here.

2. Embedding the URL in SendGrip template

You can either create a new design or edit your existing design. In this example, we are going to create a new simple design.

Once your template is loaded, then drag the Image module to the top of your template. Leave the image empty for now because we are going to generate the image dynamically with our query string URL.

Add any other additional modules that fits your requirement.

Edit the image module's HTML to include our query string URL. Please ensure that the SendGrid template variable is corrrect.

<img src="{{First_Name}}">

You're set!

3. Sending a test email

Send a test email to see this in action.

The variable name has been changed to our user's first name.

Use JPEG to load the image faster due to its smaller size. Stencil also caches the generated image, so any subsequent requests will be faster.

It's really easy and the amount of time saved is simply amazing.

You can build similar workflow in any other email providers like Mailchimp, Mailgun etc.

Last updated