Mautic v3.3.1 - Issue with Sending, Broadcasting, Campaign and Segment Emails

Your software
Mautic v3.3.1 VPS Self-hosted installation on sub-domain.
My PHP version is: PHP74
My Database type and version is: MySQL 5.7.14

Your problem
Issue with Broadcasting emails
Issue with Campaign emails automatically sent by campaigns, forms, point triggers.
Issue with Segment emails

These errors are showing in the log:

Current Error Log
Today’s Mautic error log is empty. Check server error log for error messages Mautic didn’t have a chance to catch.

Server Error Log

[09-Mar-2021 19:32:01 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 12288 bytes) in /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/app/bundles/EmailBundle/Entity/Stat.php on line 230
[09-Mar-2021 19:32:01 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32768 bytes) in /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/vendor/symfony/debug/Exception/OutOfMemoryException.php on line 1

Steps I have tried to fix the problem:

Increased Memory - user.ini and php.ini

[PHP]
display_errors = Off
max_execution_time = 600
max_input_time = 60
max_input_vars = 1000
memory_limit = 8192M
post_max_size = 8192M
session.gc_maxlifetime = 1440
session.save_path = “/var/cpanel/php/sessions/ea-php74”
upload_max_filesize = 8192M
zlib.output_compression = Off

Checked to confirm Cron Jobs are working. See extract from logs:

Mar 8 17:45:01 server CROND[22731]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:segments:update)
Mar 8 17:47:01 server CROND[23013]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:emails:send)
Mar 8 17:48:01 server CROND[23109]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:messages:send)
Mar 8 17:50:01 server CROND[23293]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:campaigns:update)
Mar 8 17:52:01 server CROND[23586]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:emails:send)
Mar 8 17:52:01 server CROND[23588]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:broadcasts:send)
Mar 8 17:55:01 server CROND[23848]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:campaigns:trigger)
Mar 8 17:57:01 server CROND[24152]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:emails:send)
Mar 8 18:00:01 server CROND[24397]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:messages:send)
Mar 8 18:00:01 server CROND[24398]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:broadcasts:send)
Mar 8 18:00:01 server CROND[24401]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:email:fetch)
Mar 8 18:00:01 server CROND[24399]: (xxxxxxxxxx) CMD (/usr/local/bin/php /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/bin/console mautic:segments:update)

Within cPanel I checked Email Deliverability Status and results show - VALID

I’m using Amazon SES via SMTP as the sending server. Test connection is successful. ‘Send Test Email’ via Amazon SES are received.

Within Mautic v3.3.1 ‘Send Example Emails’ are working.

I’m looking for a fix or some feedback on the following:
Issue with Broadcasting emails
Issue with Campaign emails automatically sent by campaigns, forms, point triggers.
Issue with Segment emails

On clicking ‘SEND’ Emails Mautic displays that they have been sent out successfully but the email are not delivered.

I’d appreciate any help with this. Thanks.

Regards,

-Martin

Hello Martin!
When you go to in Mautic to Settings > System Info
What do you see by “memory_limit” variable?

Thx,
Joey

UPDATE

I went back over my Mautic Settings.

Noticed that emails were sent to var/spool

Checked:

Configuration → Email Settings → Mail Send Settings → How should email be handled?

I had this set to ‘Filesystem Queue’

Changed to ‘Send Immediately’

RESULT

Broadcasting emails work.

However there are still issues:

With Campaign emails automatically sent by campaigns, forms, point triggers.
With Segment emails

I continue to get Server Error. See below Log

[10-Mar-2021 11:48:01 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 12288 bytes) in /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/app/bundles/EmailBundle/Entity/Stat.php on line 230
[10-Mar-2021 11:48:01 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32768 bytes) in /home/xxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/vendor/symfony/debug/Exception/OutOfMemoryException.php on line 1

Hi, this is not a solution, you just mitigated one issue: queue.
And you SHOULD use queue if you want reliable sending.

You have 2 problems:

  1. your memory settings are off
  2. your cron command is wrong. Especially the mautic:email:send command.

Hi Joey,

Thank for replying.

Just checked memory limit:

memory_limit 8192M 8192M

What’s the correct cron command to use
?

Could you change your memory to 512M ?

The right cron command: Plz send me your current cron command (that works) in priv message, I’ll answer you the command for email.

Or you can also check this guide:

Just make sure you are using /bin/ instead of /app/ in the command if you have Mautic 3.0+

The memory limit is a per script setting, you don’t want to set it to 8GB unless you are hosting at the CERN.

I found, that most Mautic instances are just fine with 512M.

Ok- Thanks. I changed the memory limit back to 512M

Checking the cron for email send

Ok, let me know if 512 helped.

Hi Joey,

I’m checking the crons but noticed that on your webpage you use singular terms for segment and broadcast:

/bin/console mautic:segment:update

/bin/console mautic:broadcast:send

Mautic Documentation shows plural terms for segment and broadcast:

/bin/console mautic:segments:update

/bin/console mautic:broadcasts:send

Which set are correct?

UPDATE

I ran the cron with the settings suggested on your webpage

/bin/console mautic:segment:update

/bin/console mautic:broadcast:send

Campaign and Segment emails are being received now. I think that Mautic Doc may need to be updated to reflect the correct cron settings.

Also I think that the memory errors have stopped. I’ll monitor and can update later. All good for now.

Thanks for your all your help with this.

Singular or plural - both work

Thanks good to know.

I just checked the errors log again and the previous errors have been resolved.

Cheers!

I’m too facing the below error -

[WARNING] Some commands could not be registered: In RotatingFileHandler.php line 51: DateTime::__construct(): Invalid date.timezone value ‘UTC+5:30’, we selecte d the timezone ‘UTC’ for now. In RotatingFileHandler.php line 51: DateTime::__construct(): Invalid date.timezone value ‘UTC+5:30’, we selecte d the timezone ‘UTC’ for now. In RotatingFileHandler.php line 51:

tried changing the server time and even specific file time for UTC as well as Asia/Kolkata but still somehow getting the same error