Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding custom header values for Mailgun

Featured Replies

  • Newbies

Hi, we're sending SMTP emails through Mailgun to communicate with our event attendees. In order to group the emails appropriately, it looks like I have to tag them by attaching custom variables in the header. EmailSetHeader is straightforward enough, but is it possible to use it to attach, for example, X-Mailgun-Variables: {"my_message_id": 123}? I've linked the documentation I've found below but am still unclear on the right syntax. Would appreciate any direction.

 

https://documentation.mailgun.com/en/latest/user_manual.html#attaching-data-to-messages

X-Mailgun-Variables: {"first_name": "John", "last_name": "Smith"}
X-Mailgun-Variables: {"my_message_id": 123}

https://static.360works.com/plugins/EMAILPLUG/documentation.html#EmailSetHeader

EmailSetHeader( "reply-to" ; "[email protected]" )
EmailSetHeader( "bcc" ; "[email protected]" )
EmailSetHeader( "subject" ; "List of Example Headers" )

Edited by rayjay

Hi rayjay,

You should be able to just add the name of the headers you want to add for the "header" parameter and then whatever that value needs to be for the "value" parameter. I ran a quick test where I supplied a made up header name "X-Test-header" with a value of "{test value}". Checking the headers of the delivered email, this shows up as X-Test-header: ⁨{test value} . So for your case your function call would look something like:

EmailSetHeader("X-Mailgun-Variables"; "{"first_name": "John", "last_name": "Smith"}")

You will have to escape those quotes within the {} so that the whole value is seen as a string by the script workspace

  • Author
  • Newbies

Thanks Ryan!

 

EDIT: Some examples I got working...

EmailSetHeader( "X-Mailgun-Variables"; "{" & Quote("CAMPAIGNID") & ":" & Quote("PFY20201216") & "}" )
SETS: X-Mailgun-Variables: {"CAMPAIGNID":"PFY20201216"}

EmailSetHeader( "X-Mailgun-Variables"; "{" & Quote("TARGETID") & ":" & EMAILS::UserID & "}" )
SETS: X-Mailgun-Variables: {"TARGETID":154768904323}

 

Edited by rayjay

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.