Mailgun X-Mailgun-Variables are not sent in webhooks for email received
Asked Answered
E

1

6

I have a rails app and I'm sending email through Mailgun smtp

mail(
  to: @user.email,
  subject: 'Notification From ME',
  'X-Mailgun-Variables' => { subscription_id: subscription.id }.to_json
)

The header is showing in google full email view (original message) as

X-Mailgun-Variables: {"subscription_id":2}

When I reply to the email the webhook notification that I receive docent have the variables in the payload.

Should this header be visible to the clients ?

How should I setup or send my variables to mailgun so I can receive them when email relay webhook is triggered ?

Euphemia answered 4/10, 2017 at 16:55 Comment(0)
K
0

According to the documentation:

When using variables, the X-Mailgun-Variables header will be included in the MIME of the delivered email. This means that recipients who receive emails when variables are used WILL be able to see the variables if they view the MIME headers.

It sounds like what you're really looking for is Tagging however, that is not supported via the SMTP method you appear to be using. However, if you use Ruby then there is a SDK package that will enable you to send messages with tagging. You can find the Ruby library for Mailgun on Github at: https://github.com/mailgun/mailgun-ruby

Kaitlynkaitlynn answered 26/9, 2023 at 21:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.