How to implement my own plugin able to merge tokens on e-mails

Hello there!

My name is Matias and I’m trying to implement Mautic in our company.

I already have a working environment, but I came across a specific requirement: I need to use a mailer service that provides a rudimentary JSON API and does not support token replacement.

Anyway, I set out to try and implement a plugin to support this service.

I am already sending emails, but without being able to merge the tokens.

From my understanding of the problem, this work is done by default by the mailer service.

Is there any way for this to be processed by my plugin? From the little I’ve studied, I imagine implementing a service derived from EmailSubscriber. Do you have any reference code so I can investigate?

I know this is a lot of questions for a first post, but I appreciate any document you can indicate.

Thank you!


Hi Matias, my understand is that the mautic tokens ( are processed by mautic before sending it to the mailer/smtp service.

Hi Leo.

Thanks for the answer.

This was my understanding too until I saw my messages being delivered without the tokens being replaced.

The tracking pixel is also not embedded as it is also a token.

If Mautic must do this, then I need to take some action before sending the payload expected by the email service API. What would it be?

Thank you for your attention.


a while ago I was using elasticmail which has its own tokens that you can use, and I remember having to handle both steps of token replacement, from mautic and from elastic mail. so I guess your issue is in the mautic configuration/ setup because handling the tokens should be a standard feature.

perhaps posting this issue on configuration and support topics (Support - Mautic Community Forums) would be better and people might be able to figure out why your tokens are not being replaced.

Leo, thank you for your time and patience. I will try your suggestion.