Henrique Rodrigues
Henrique Rodrigues

Reputation: 1

Sending mails in mautic

It's my first question here, excuse me if i'm being totally stupid.

I have a Mautic installation and I have my emails sent by cronjobs. Works like a charm.

I have a need to send some specific messages immediately and I'm trying to hack some code in order to do it.

I noticed that you can send emails immediately when you send test emails to yourself. I'm trying to replicate this behavior without success through an event listener.

Everything workks fine, I can capture the event and manipulate it, change everything in the message, etc., but I can't change the way the sistem sends the messages.

Anyone has any idea how to do it?

thanks in advance.

Upvotes: 0

Views: 391

Answers (1)

Henrique Rodrigues
Henrique Rodrigues

Reputation: 1

I figured it out myself. Summarizing, in the event listener I just needed to "clone" the mailer into a sample mailer. here's a code example:

$temporaryMailer = (new MailerHelper())->getSampleMailer();
$temporaryMailer->setEmail($entity); // you can obtain this from the getEmail() method from the event
$temporaryMailer->setTo('recipients');
$temporaryMailer->send();

Upvotes: 0

Related Questions