We're experiencing difficulty. Our engineers are on it. Please check status.mailgun.com for real-time updates.

How can I personalize my emails when using Email Templates?

Article Preview

    Overview

    On the design page, click within any text box and then place your cursor where you want to add the personalized text. Next, click on Variables from the menu.

     

    Screen Shot 2022-07-06 at 1.56.30 PM.png
     
    Select the Type of variable ("Custom transactional variable") and then enter a Variable name. This variable name will need to correspond to one of the variables that you use in the X-Mailgun-Variables parameter of your API request (see the hyperlinked text for full details on using the Mailgun Templates API along with the Messages API).  For example, you could enter the Variable name “firstname”.
     
    Screen Shot 2022-07-06 at 1.57.24 PM.png

    With the variable of "firstname" configured in the template, you'll see the {{firstname}} placeholder in the selected text box:
     
    Screen Shot 2022-07-06 at 2.58.25 PM.png
    Using a different example, below is what the recipient of the email ("Ruby") would see in her mailbox: 

    Personalization
     
    The value "Ruby" is supplied to the "firstname" variable within the API request submitted to Mailgun. Here's an example of the cURL request that assigns the value "Ruby" to the variable "firstname".
     
    curl -s --user 'api:YOUR_API_KEY' \
    https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \
    -F from='A1 Car Rental <rental@YOUR_DOMAIN_NAME>' \
    -F to='ruby.test@example.com' \
    -F subject='Biggest Discounts Of The Year!!!' \
    -F template='template.test' \
    -F t:variables='{"firstname": "Ruby"}'

     

    Need Support?

    Our Support Team here at Sinch Mailgun is happy to help! Reach out to us in the Support section of your Mailgun Control Panel, and we'll be with you shortly!