Newbies rayjay Posted December 15, 2020 Newbies Posted December 15, 2020 (edited) 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 December 15, 2020 by rayjay
ryan360Works Posted December 15, 2020 Posted December 15, 2020 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
Newbies rayjay Posted December 15, 2020 Author Newbies Posted December 15, 2020 (edited) 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 December 17, 2020 by rayjay
Recommended Posts
This topic is 1774 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now