docker-mautic icon indicating copy to clipboard operation
docker-mautic copied to clipboard

Scheduled Segment Emails not sending out

Open papaslumpf opened this issue 11 months ago • 25 comments

On my installation scheduled emails are not sending. Looking into the configuration of "mautic_cron" instance it seems that setting a cronjob for mautic:broadcasts:send is missing. Is this by accident or by design?

papaslumpf avatar Jan 20 '25 10:01 papaslumpf

Having the same issue. @papaslumpf did you managed to fix it?

thiagoferolla avatar Jan 22 '25 19:01 thiagoferolla

I'm having the same issue using v5.2.1. Has anyone made any progress in this?

duduzeta avatar Jan 24 '25 00:01 duduzeta

Having the same issue. @papaslumpf did you managed to fix it?

Haven't tried to fix it as I'm currently still hoping that someone from the creators of the image will fix this.

To fix this you have to create your own image based on mautic/docker-mautic including all the necessary cronjobs as in https://github.com/mautic/docker-mautic/tree/mautic5/common/entrypoint_mautic_cron.sh

As I see there are currently only mautic:segments:update , mautic:campaigns:update , and mautic:campaigns:trigger handled.

Whatever the reason is.

papaslumpf avatar Jan 24 '25 07:01 papaslumpf

Having the same issue. @papaslumpf did you managed to fix it?

Haven't tried to fix it as I'm currently still hoping that someone from the creators of the image will fix this.

To fix this you have to create your own image based on mautic/docker-mautic including all the necessary cronjobs as in https://github.com/mautic/docker-mautic/tree/mautic5/common/entrypoint_mautic_cron.sh

As I see there are currently only mautic:segments:update , mautic:campaigns:update , and mautic:campaigns:trigger handled.

Whatever the reason is.

Are you saying there are more then these 3?

raymatos avatar Feb 11 '25 14:02 raymatos

Having the same issue. @papaslumpf did you managed to fix it?

Haven't tried to fix it as I'm currently still hoping that someone from the creators of the image will fix this. To fix this you have to create your own image based on mautic/docker-mautic including all the necessary cronjobs as in https://github.com/mautic/docker-mautic/tree/mautic5/common/entrypoint_mautic_cron.sh As I see there are currently only mautic:segments:update , mautic:campaigns:update , and mautic:campaigns:trigger handled. Whatever the reason is.

Are you saying there are more then these 3?

Of course, as in my initial post mentioned mautic:broadcasts:send is not triggered within the cron container. Unfortunately this is the relevant command for scheduled segment emails sending out.

papaslumpf avatar Feb 11 '25 15:02 papaslumpf

I was able to fix it, i think those crons are setup if you are using queue based (rabbitmq). I'll share the docker compose file i used to make it work.

It is a shame that the creators are very very slow to respond and by the looks of the PR, even becoming a contributor is not going to help as they dont even merge basic pull request.

raymatos avatar Feb 11 '25 15:02 raymatos

I think I managed to fix that, I replaced the original cron Mautic file /opt/mautic/cron/mautic with this command:

cat << EOF > /opt/mautic/cron/mautic
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
BASH_ENV=/tmp/cron.env

* * * * * php /var/www/html/bin/console mautic:segments:update 2>&1 | awk '{print "[segments:update] " \$0}' | tee -a /tmp/stdout
* * * * * php /var/www/html/bin/console mautic:campaigns:update 2>&1 | awk '{print "[campaigns:update] " \$0}' | tee -a /tmp/stdout
* * * * * php /var/www/html/bin/console mautic:campaigns:trigger 2>&1 | awk '{print "[campaigns:trigger] " \$0}' | tee -a /tmp/stdout
* * * * * (sleep 40; php /var/www/html/bin/console mautic:segments:update) 2>&1 | awk '{print "[segments:update-delayed] " \$0}' | tee -a /tmp/stdout
* * * * * (sleep 30; php /var/www/html/bin/console mautic:campaigns:update) 2>&1 | awk '{print "[campaigns:update-delayed] " \$0}' | tee -a /tmp/stdout
* * * * * (sleep 20; php /var/www/html/bin/console mautic:campaigns:trigger) 2>&1 | awk '{print "[campaigns:trigger-delayed] " \$0}' | tee -a /tmp/stdout

* * * * * php /var/www/html/bin/console mautic:messages:send --no-interaction 2>&1 | awk '{print "[messages:send] " \$0}' | tee -a /tmp/stdout
* * * * * php /var/www/html/bin/console mautic:broadcasts:send 2>&1 | awk '{print "[broadcasts:send] " \$0}' | tee -a /tmp/stdout
* * * * * php /var/www/html/bin/console messenger:consume email --no-interaction 2>&1 | awk '{print "[messenger:consume] " \$0}' | tee -a /tmp/stdout
* * * * * php /var/www/html/bin/console mautic:webhooks:process 2>&1 | awk '{print "[webhooks:process] " \$0}' | tee -a /tmp/stdout

*/10 * * * * php /var/www/html/bin/console mautic:email:fetch 2>&1 | awk '{print "[email:fetch] " \$0}' | tee -a /tmp/stdout
*/15 * * * * php /var/www/html/bin/console mautic:email:process --no-interaction 2>&1 | awk '{print "[email:process] " \$0}' | tee -a /tmp/stdout
*/15 * * * * php /var/www/html/bin/console mautic:contacts:deduplicate --no-interaction 2>&1 | awk '{print "[contacts:deduplicate] " \$0}' | tee -a /tmp/stdout

0 3 * * * php /var/www/html/bin/console mautic:iplookup:download 2>&1 | awk '{print "[iplookup:download] " \$0}' | tee -a /tmp/stdout
0 4 5 * * php /var/www/html/bin/console mautic:maintenance:cleanup --days-old=365 --no-interaction 2>&1 | awk '{print "[maintenance:cleanup] " \$0}' | tee -a /tmp/stdout
0 1 * * * php /var/www/html/bin/console mautic:points:update 2>&1 | awk '{print "[points:update] " \$0}' | tee -a /tmp/stdout

EOF

This is a full cron for all useful stuff and this env on the docker container: MESSENGER_TRANSPORT_DSN

Pointing to your RabbitMQ, not really sure what was the issue, but al least for me, is working with these two changes

JuanxCursed avatar Feb 15 '25 15:02 JuanxCursed

version: '3'

x-mautic-volumes:
  &mautic-volumes
  - ./mautic/config:/var/www/html/config:z
  - ./mautic/logs:/var/www/html/var/logs:z
  - ./mautic/media/files:/var/www/html/docroot/media/files:z
  - ./mautic/media/images:/var/www/html/docroot/media/images:z
  - ./cron:/opt/mautic/cron:z
  - mautic-docroot:/var/www/html/docroot:z

services:
  db:
    image: mysql:8.0
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    volumes:
      - mysql-data:/var/lib/mysql
    restart: unless-stopped
    healthcheck:
      test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD ping
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 10
    networks:
      - default

  rabbitmq:
    image: rabbitmq:3
    environment:
      - RABBITMQ_DEFAULT_VHOST=${RABBITMQ_DEFAULT_VHOST}
    volumes:
      - rabbitmq-data:/var/lib/rabbitmq
    restart: unless-stopped
    networks:
      - default

  nginx:
    image: nginx
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - mautic-docroot:/var/www/html/docroot:z
    depends_on:
      - mautic_web
    ports:
      - 8002:80
    restart: unless-stopped
    networks:
      - default

  mautic_web:
    image: mautic/mautic:5.2.1-fpm
    links:
      - db:mysql
    volumes: *mautic-volumes
    restart: unless-stopped
    environment:
      - DOCKER_MAUTIC_LOAD_TEST_DATA=${DOCKER_MAUTIC_LOAD_TEST_DATA}
      - DOCKER_MAUTIC_RUN_MIGRATIONS=${DOCKER_MAUTIC_RUN_MIGRATIONS}
    env_file:
      - .mautic_env
    healthcheck:
      test: cgi-fcgi -bind -connect 127.0.0.1:9000
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 100
    depends_on:
      db:
        condition: service_healthy
    networks:
      - default

  mautic_cron:
    image: mautic/mautic:5.2.1-fpm
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_cron
    env_file:
      - .mautic_env
    depends_on:
      mautic_web:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - default

  mautic_worker:
    image: mautic/mautic:5.2.1-fpm
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_worker
    env_file:
      - .mautic_env
    depends_on:
      mautic_web:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - default

volumes:
  mysql-data:
  rabbitmq-data:
  mautic-docroot:

networks:
  default:
    name: ${COMPOSE_PROJECT_NAME}-docker

Are you getting uploaded images to work? For me i get 404

raymatos avatar Feb 17 '25 22:02 raymatos

version: '3'

x-mautic-volumes:
  &mautic-volumes
  - ./mautic/config:/var/www/html/config:z
  - ./mautic/logs:/var/www/html/var/logs:z
  - ./mautic/media/files:/var/www/html/docroot/media/files:z
  - ./mautic/media/images:/var/www/html/docroot/media/images:z
  - ./cron:/opt/mautic/cron:z
  - mautic-docroot:/var/www/html/docroot:z

services:
  db:
    image: mysql:8.0
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    volumes:
      - mysql-data:/var/lib/mysql
    restart: unless-stopped
    healthcheck:
      test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD ping
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 10
    networks:
      - default

  rabbitmq:
    image: rabbitmq:3
    environment:
      - RABBITMQ_DEFAULT_VHOST=${RABBITMQ_DEFAULT_VHOST}
    volumes:
      - rabbitmq-data:/var/lib/rabbitmq
    restart: unless-stopped
    networks:
      - default

  nginx:
    image: nginx
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - mautic-docroot:/var/www/html/docroot:z
    depends_on:
      - mautic_web
    ports:
      - 8002:80
    restart: unless-stopped
    networks:
      - default

  mautic_web:
    image: mautic/mautic:5.2.1-fpm
    links:
      - db:mysql
    volumes: *mautic-volumes
    restart: unless-stopped
    environment:
      - DOCKER_MAUTIC_LOAD_TEST_DATA=${DOCKER_MAUTIC_LOAD_TEST_DATA}
      - DOCKER_MAUTIC_RUN_MIGRATIONS=${DOCKER_MAUTIC_RUN_MIGRATIONS}
    env_file:
      - .mautic_env
    healthcheck:
      test: cgi-fcgi -bind -connect 127.0.0.1:9000
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 100
    depends_on:
      db:
        condition: service_healthy
    networks:
      - default

  mautic_cron:
    image: mautic/mautic:5.2.1-fpm
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_cron
    env_file:
      - .mautic_env
    depends_on:
      mautic_web:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - default

  mautic_worker:
    image: mautic/mautic:5.2.1-fpm
    links:
      - db:mysql
    volumes: *mautic-volumes
    environment:
      - DOCKER_MAUTIC_ROLE=mautic_worker
    env_file:
      - .mautic_env
    depends_on:
      mautic_web:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - default

volumes:
  mysql-data:
  rabbitmq-data:
  mautic-docroot:

networks:
  default:
    name: ${COMPOSE_PROJECT_NAME}-docker

Are you getting uploaded images to work? For me i get 404

Since you get a 404 error it seems your nginx container is running. And if this is running, the mautic_web container must also be running because the nginx depends on it. Most likely you have to check your nginx.conf file.

papaslumpf avatar Feb 18 '25 08:02 papaslumpf

@raymatos in your nginx config, add this to volumes:

      - ./mautic/media/files:/var/www/html/docroot/media/files:z
      - ./mautic/media/images:/var/www/html/docroot/media/images:z

So, in total, it would look like this:

nginx:
    image: nginx
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - mautic-docroot:/var/www/html/docroot:z
      - ./mautic/media/files:/var/www/html/docroot/media/files:z
      - ./mautic/media/images:/var/www/html/docroot/media/images:z
    depends_on:
      - mautic_web
    ports:
      - 8002:80
    restart: unless-stopped
    networks:
      - default

O-Mutt avatar Mar 01 '25 22:03 O-Mutt

Hey there! I'm helping the new maintainers of this repository. It was neglected for some time but that changes now! Could you please re-test if you are still getting this issue so we could focus our limited time on the issues that are still relevant? If there will be no response we'll close this issue in 1 week. It can always be re-opened later on.

IonutOjicaDE avatar Apr 15 '25 16:04 IonutOjicaDE

This is still an issue, yes

O-Mutt avatar Apr 17 '25 16:04 O-Mutt

Hello,

We'll have a look on this issue after organizing a few things.

We'll keep you updated!

cibero42 avatar Apr 23 '25 10:04 cibero42

@henmohr

Probably this issue links back to the other cron ones I've assigned to you. If they all are related to the exact same problem, could you please close the other ones by using "Close as duplicate" pointing to this one?

It's better if we could centralize them, not to disperse attention.

cibero42 avatar Apr 25 '25 09:04 cibero42

Hello everyone!

We've pushed a PR that should fix this issue.

@O-Mutt , the updated image with the fix should be uploaded in half an hour. Could you please verify if it indeed fixed this issue?

Use one of the following tags:

  • 5.2.5-apache
  • 5-apache
  • 5.2-apache
  • latest

@O-Mutt , regarding the memory runaway, please enable limits on each container to prevent causing a DoS on your server. If you wish us to investigate this, please open a new issue (it will take a while until we'll look at it, though).

Cheers, Renato

cibero42 avatar Apr 29 '25 08:04 cibero42

@cibero42 Thanks for your great effort. I haven't tested the new version so far as I'm using the fpm-variant, but have had a look at the crontab file here https://github.com/mautic/docker-mautic/tree/mautic5/common/entrypoint_mautic_cron.sh.

Lots of updates here, which is pretty cool. However it seems that the broadcast send out is still missing. When I ran into this issue, mautic:broadcasts:send was the only command that actually sent out the broadcast emails. None of the mautic:campaign:...- ones worked here.

papaslumpf avatar Apr 29 '25 08:04 papaslumpf

Hello @papaslumpf ,

I've skipped this one because, according to the documentation, there are some parameters that should be configured per environment.

Perhaps we could think about more generic parameters to enable it, what do you think?

@escopecz , do you also have thoughts on this?

cibero42 avatar Apr 29 '25 08:04 cibero42

@papaslumpf ,

You can also test using the FPM image - actually 5-fpm has already been pushed to docker hub.

I'm still waiting the apache version to finish building - it seems to be stuck...

cibero42 avatar Apr 29 '25 08:04 cibero42

Hello @papaslumpf ,

I've skipped this one because, according to the documentation, there are some parameters that should be configured per environment.

Perhaps we could think about more generic parameters to enable it, what do you think?

@escopecz , do you also have thoughts on this?

Good point. Mautic is not a complete DFY service. So if someone installs mautic, I'd expect that basic configuration is done properly. For sending limt I'd go with a default of 100 with the cronjob run every minute.

papaslumpf avatar Apr 29 '25 11:04 papaslumpf

Hello @papaslumpf ,

Thank you! We'll think and test a way to do it, after we figure out @O-Mutt 's issue.

Sorry for the delay on solving this - there's only two maintainers at the moment (me and @henmohr ), so it's a bit hard to move things fast.

cibero42 avatar Apr 29 '25 21:04 cibero42

Hello everyone,

Could someone state if this issue was solved?

@O-Mutt and I did multiple improvements on the last few months regarding the image.

Thanks!

cibero42 avatar Jul 16 '25 09:07 cibero42

Hi, still happening to me on 5.2.6, set up the cron manually and it works fine.

pedrogius avatar Jul 22 '25 12:07 pedrogius

Hi, still happening to me on 5.2.6, set up the cron manually and it works fine.

Hello, could you please tell us which cron directive solves the issue?

Thanks!

cibero42 avatar Jul 22 '25 18:07 cibero42

Hi, still happening to me on 5.2.6, set up the cron manually and it works fine.

Hello, could you please tell us which cron directive solves the issue?

Thanks!

*/5 * * * * php /var/www/html/bin/console mautic:broadcasts:send --channel=email --limit=200 --batch=7 2>&1 | tee /tmp/broadcasts-send.log

Just added that into the cron file from the cron container.

pedrogius avatar Jul 22 '25 18:07 pedrogius

Hello,

Thanks @pedrogius ! Would you like to contribute the fix? If so, you just need to:

  1. Fork
  2. Edit this file: https://github.com/mautic/docker-mautic/blob/mautic5/common/templates/mautic_cron
  3. Open a PR with a good description

This way I could test and merge for you. Please let me know!

cibero42 avatar Jul 31 '25 06:07 cibero42