December 15, 20205 yr 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 December 15, 20205 yr by rayjay
December 15, 20205 yr 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
December 15, 20205 yr 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 December 17, 20205 yr by rayjay
Create an account or sign in to comment