Transactional emails via API

Hi !



Is there any way to create templates with placeholders to send transactional emails like Welcome emails, or recover password emails ?



It is very helpfull to have the transactional emails layout separated from the backend code and just call a restfull API to send this kind of emails to a single user when needed.

Hi !

Is there any way to create templates with placeholders to send transactional emails like Welcome emails, or recover password emails ?

It is very helpfull to have the transactional emails layout separated from the backend code and just call a restfull API to send this kind of emails to a single user when needed.

I am also trying to figure out how to do this. Anyone have any info?

Hi @mrmirz the Mautic API does support sending an email to a contact. Api call is sendToContact($id, $contactId) in the emails context. So something like

// create context
$emailApi = $api->newApi('emails', $auth, $apiUrl);
// now send a known email ($id) to a known contact ($contactId)
$response = $emailApi->sendToContact($Id, $contactId);

so assuming you set up your email(s) correctly it should work like a charm.

Hi @MarkLL thanks for the reply!

I did find that request in the API, but what I’m specifically looking for is whether we can pass data to a placeholder in the template via the API. As @seboraid mentioned, for a forgot password feature we’d need to dynamically insert a forgot password link into the email template. There’s other examples we want to achieve but we’d need to be able to pass some data from our database into the email template when programmatically triggering the email.

I’m also trying to figure out how to deal with the unsubscribes if I manage both my application’s transactional emails as well as marketing automation through Mautic. As I understand it, users are unsubscribed from all sending if they unsubscribe from one of the emails. I assume we’d need to run two instances of Mautic to avoid not being able to send them basic transactional emails.

Anyone know if this is possible?

We are also wondering whether this is possible, i.e. passing temporary content such as the above password reset link example via placeholder variables to a transactional email?

+1

Hey @mrmirz

Did you create two Mautic instances to solve the problem regarding unsubscribed users? Or did you solve it some other way?