0

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.

  • We will help if we see code. Show what works, what does not and where the problem lies. Read https://stackoverflow.com/help/mcve – Nic3500 Mar 20 '18 at 00:35
  • Thanks @Nic3500, I'll try my best to format my question properly next time. I've figured out my problem. I'll update and close the topic 0/ – Henrique Rodrigues Mar 20 '18 at 15:35

1 Answers1

0

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();