Mautic Community Forums

Failed to execute campaign event , email are not triggered inside campaigns

Your software
My Mautic version is: 3.3.2
My PHP version is: 7.3.27
Database version: Percona Server for MySQL 5.7.31-34

Your problem
Emails are not sent using campaigns !

I want to use queued email , for testing purpose I put 1 email every 5 min and I did the following steps:
-Create a segment that contains 3 users and publish it
-Create a 2 campaigns (transactional & marketing) and send 2 different emails
-Publish the campaigns and wait
-I got notifications with this message

There is no error in the logs !

Steps I have tried to fix the problem:
-Clear the cache
-Run cronjob manually to see if there is any error and double check the cron file (no issue)
-Check Path to the cache directory & to log directory (no issue)
-Upgrade to the last version of mautic (no issue)
-Delete & create the campaigns
-Test email sending from the configuration and send manual email (no issue)
-Added --env=prod at the end of every cron job
-Change the trigger from every 5min to every 1min…

This is my cron file

8,23,38,52 * * * * www-data php /var/www/html/bin/console mautic:segments:update > /var/log/cron.pipe 2>&1 --env=prod
*/5 * * * * www-data php /var/www/html/bin/console mautic:import > /var/log/cron.pipe 2>&1 --env=prod
5,20,35,50 * * * * www-data php /var/www/html/bin/console mautic:campaigns:rebuild > /var/log/cron.pipe 2>&1 --env=prod
2,17,32,47 * * * * www-data php /var/www/html/bin/console mautic:campaigns:trigger > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:messages:send > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:emails:send > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 */1 * * * www-data php /var/www/html/bin/console mautic:email:fetch > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:social:monitoring > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:webhooks:process > /var/log/cron.pipe 2>&1 --env=pord
0,15,30,45 */1 * * * www-data php /var/www/html/bin/console mautic:broadcasts:send > /var/log/cron.pipe 2>&1 --env=prod
* 1 * * * www-data php /var/www/html/bin/console mautic:maintenance:cleanup --days-old=365 > /var/log/cron.pipe 2>&1 --env=prod
0 4 15 * * www-data php /var/www/html/bin/console mautic:iplookup:download > /var/log/cron.pipe 2>&1 --env=prod
*/5 * * * * www-data php /var/www/html/bin/console mautic:reports:scheduler > /var/log/cron.pipe 2>&1 --env=prod
0 5 10 * * www-data php /var/www/html/bin/console mautic:unusedip:delete > /var/log/cron.pipe 2>&1 --env=prod

I have tried many stuff and browse almost all issues in the forum and GitHub discussions but sadly I am blocked and my campaigns are not working .

This is what I get wen I run “php console mautic:campaigns:trigger”

Email configuration in mautic

Test email

Hey @zak

Could you post a screenshot of your segment filters and also a screenshot of your campaigns and the actions.

From the console output to me it looks like your campaign is working, however it is failing or going down the negative path on the scheduled event.

Interesting to see the other screenshots and see if we can help you troubleshoot this.

Thanks for your reply @mikew

This is a screenshot of my segment, we can see that I have 3 contacts

The campaigns & actions

Actions are always pending

Preview of the builder

image

image

The emails are published and this is the 2 cronjob that I have changed :

*/2 * * * * www-data php /var/www/html/bin/console mautic:emails:send > /var/log/cron.pipe 2>&1 --env=prod
*/2 * * * * www-data php /var/www/html/bin/console mautic:broadcasts:send > /var/log/cron.pipe 2>&1 --env=prod

Hey thanks for that. Sorry forgot to ask, can you also check your logs

/var/log/nginx/mautic.error

or for apache2
/var/log/apache2/mautic.error

Another thing go to your contacts first and in the top right, click on campaigns
image
remove them from the campaign and then re-add them. Simply turn the switch on and off, also please make sure for this campaign contacts can restart campaign.

Then go check out your logs, I like to watch them live with the command: tail -f /var/log/nginx/mautic.error

1 Like

What happens if you change to transactional email?
Maybe you have a frequency setting, that prohibits the send.
Also: you should use the native Amazon SMTP integration via port 465, not Custom SMTP.

1 Like

Run www-data php /var/www/html/bin/console swiftmailer:spool:send in ssh. If it works add it to your cron jobs

Correct. But it will send out the queue.
The issue here is, that he has

  1. bunch of newsletters to blast out that takes hours
  2. transactional emails, which need to go out right away

So how can he prioritize the transactional emails (should go out immediatly) even if there is a huge flow of broadcast emails “blocking” the pipeline? So he will have mixed emails in the queue: transactional and broadcast. How to give priority to the transactional? :slight_smile:

GEEZ I’M SUCH AN IDIOT.
This is another thread…
My Apologies, it’s late.

Hi @mikew ;
This is the logs from apache2/error.log

AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using X.X.X.X (Ip address). Set the ‘ServerName’ directive globally to suppress this message
[Mon Apr 05 19:38:12.303469 2021] [mpm_prefork:notice] [pid 11] AH00163: Apache/2.4.38 (Debian) PHP/7.3.27 configured – resuming normal operations
[Mon Apr 05 19:38:12.303507 2021] [core:notice] [pid 11] AH00094: Command line: ‘apache2 -D FOREGROUND’

I don’t see the nginx logs. FYI, I am using mautic with docker.

After investigation, I migrate mautic to the last version and did another test with small dataset (1 email very 2 min) it worked perfectly for both marketing and transactional emails. The segment size is 10 emails.

But, I am still confused about mautic campaigns because today I did a bigger test with a large data (20 emails in 1h) and I don’t know if it is working or not !

This is an example of my last test :

As you can see, it says that all actions are completed and the campaign statistics does not show any other information.

When I go to calendar, I got the following :

image

The campaign triggers at 4:17 pm and send 20 emails, and according to my cronjob it should send another 20 emails at 5:17.

How can I know if the campaigns are working as expected ?

Like I said before, for a small campaigns it worked because I checked the time manually for every email (10 emails ^^).

This is my last cronjob configuration :

8,23,38,52 * * * * www-data php /var/www/html/bin/console mautic:segments:update > /var/log/cron.pipe 2>&1 --env=prod
*/5 * * * * www-data php /var/www/html/bin/console mautic:import > /var/log/cron.pipe 2>&1 --env=prod
5,20,35,50 * * * * www-data php /var/www/html/bin/console mautic:campaigns:rebuild > /var/log/cron.pipe 2>&1 --env=prod
2,17,32,47 * * * * www-data php /var/www/html/bin/console mautic:campaigns:trigger > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:messages:send > /var/log/cron.pipe 2>&1 --env=prod
0 * * * * www-data php /var/www/html/bin/console mautic:emails:send > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:email:fetch > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:social:monitoring > /var/log/cron.pipe 2>&1 --env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:webhooks:process > /var/log/cron.pipe 2>&1 --env=pord
0 * * * * www-data php /var/www/html/bin/console mautic:broadcasts:send > /var/log/cron.pipe 2>&1 --env=prod
* 1 * * * www-data php /var/www/html/bin/console mautic:maintenance:cleanup --days-old=365 > /var/log/cron.pipe 2>&1 --env=prod
0 4 15 * * www-data php /var/www/html/bin/console mautic:iplookup:download > /var/log/cron.pipe 2>&1 --env=prod
*/5 * * * * www-data php /var/www/html/bin/console mautic:reports:scheduler > /var/log/cron.pipe 2>&1 --env=prod
0 5 10 * * www-data php /var/www/html/bin/console mautic:unusedip:delete > /var/log/cron.pipe 2>&1 --env=prod

@joeyk About the Amazon configuration, for now it works. What is the cons using custom SMTP ? I don’t want to change it right now because I am afraid that I will cause a new issue !

Update
I checked amazon SES and it seems to work

1 Like

Hi guys,

I want to give you an update about my issue.

Unfortunately, it does not work since yesterday afternoon I am stuck with 480 emails, today 0 emails were send

@EJL I tried your cronjob but this is not what I am expecting, I want to send 20 emails every 1h, and when I launched your cronjob in ssh mode it sends many emails

Any idea about this issue guys?

Kind regards

Run this once an hour swiftmailer:spool:send --message-limit=20 --time-limit=20

Thanks for your answer @EJL

Now, I am confused because I thought that mautic:emails:send is calling internally swiftmailer:spool:send.

After adding this cronjob I got 40 emails sent every 1h. Could you please explain why it works now?

Why the statics are not clear in the dashboard ?

When I started the campaign I got 11878 contacts added (yellow color) but I don’t know if the email was scheduled or sent to the contact

how can I have better statics?

This is what I got in the channels->emails page

Even in the dashboard, I don’t get better information except how many users read the email, clicks …etc

Kind regards