Campaign never finish

Your software
My Mautic version is: 7.1.1 (new installation)
My PHP version is: 8.2.30
My Database type and version is: MySQL 8.4.9
I installed Mautic via: Composer

Essential cron jobs run every 5 minutes (mautic:segments:update, mautic:campaigns:update, mautic:campaigns:trigger).

The same campaign was used in Mautic 5.2.1, where it was running as it should.

Your problem
My problem is:

I created a mailing list sign-up campaign as a double opt-in process. But the email which requests to confirm the email-address of the contact is send all the time when the campaign cron jobs are triggered (every 5 minutes), even though the contact is already confirmed and has been moved in the correct segment list.

When the contact is confirmed, the campaign adds this contact again to a pending opt-in list. I wonder why?

Here is the campaign flow:

These errors are showing in the log:

No entries in the log files.

Steps I have tried to fix the problem:

  • I disabled “Allow contacts to restart the campaign”, but it did not change anything.
  • I run doctrine:migration:migrate to have the database updated, but it did not change anything as well.

Does anyone has an idea, why the process keeps running?

Hello @stemautic88,

After reading your post, there are a few things that would be useful to check in order to better understand where the issue is coming from.

From the campaign screenshot, it looks like you may be using 3rd-party plugins or custom actions for email validation and spam bot detection. Since Mautic 7.1.1 is still very recent, I would first verify whether those plugins are fully compatible with this version. I would test them independently, outside of this campaign, to confirm that they are not re-triggering contacts or changing segment/tag values unexpectedly.

I would also review each segment used in the campaign, especially the pending opt-in, confirmed mailing list, and DNC related segments. Since you migrated from Mautic 5 to Mautic 7, it is worth checking whether all segment filters and conditions were migrated correctly. Sometimes the segment itself appears to exist, but one of the conditions may be missing, changed, or no longer behaving exactly the same after a major version upgrade.

Another thing I would do is rebuild the most important segments from scratch, instead of relying only on the migrated ones. Then I would test the campaign step by step with a new test contact.

For example:

  1. Submit the form with a new contact.
  2. Check if the contact enters only the expected pending opt-in segment.
  3. Confirm the email address.
  4. Check if the contact is removed from the pending segment and moved to the correct mailing list segment.
  5. Check whether any campaign action adds the contact back to the pending opt-in segment.

This should help identify whether the issue is really caused by the campaign restart behaviour, or if something else in the campaign logic, segment conditions, or plugin actions is causing the contact to re-enter the pending opt-in flow.

My feeling is that the contact is somehow matching the entry conditions again after confirmation, possibly because of a segment condition or a migrated segment rule that is not behaving as expected in Mautic 7.

Sorry for the big post, but your automation is complex so I had to write alot eheh.
Best,
Ricardo

Hi Ricardo,

thanks for your message and suggestions.

To clarify, this is a complete new installation. The old Mautic 5.2.1 installation is on a different domain and is only used as a visual review item. Thus there has nothing been migrated from an old system.

There are no plugins installed as it is a new installation. The segment lists have all been created new on this installation, the same is true for the campaigns, and the emails used.

The contact is removed from the pending opt-in list. But somehow it is placed into the segment again. I have reviewed the campaign several times, but I couldn’t see where it loops the contact to the whole campaign again.

I haven’t set any filters for the segments yet, this is something I will try and see if this changes the behavior of the campaign.

Your last point is something I will investigate as well. Maybe there is a condition that gets triggered again.

I’ll post an update as soon as testing is done.

Thanks!

All the Best,
Stephan

Hi everyone,

here is what seems to have solved the issue:

  • I cloned the campaign
  • Changed “Campaign Republish Behaviour” from “Use Global Settings” to “Restart on republish”.

After that, the campaign works as it should. No more endless sending of confirmation emails or anything else.

Interestingly, the Campaign Republish Behavior" in the global settings is set to the same behavior “Restart on republish” as I set it in the campaign.

I can’t tell what was wrong with the campaign at the beginning, but the above solved my issues.

All the Best,
Stephan

I had a similiar issue after upgrading to 7.1.1 from 7.0.2.

When I’ve stopped and restarted a campaign the initial mail was sent over and over again (each cronjob invication). havent changed anything with the “Restart behaviour” option - it’s on “use global default”.

To workaround i’ve cloned the campaign and started directly. this worked.

Hello @stemautic88 and @larsmattia

Thank you both for sharing your findings, this is really useful!

Having 2 independent cases with the same situation (campaign restarting unexpectedly after a stop/republish cycle) on a fresh 7.1.1 install and after upgrading from 7.0.2, points to a regression rather than a configuration issue. The fact that cloning the campaign resolved it in both cases also suggests there may be a corrupted internal state being carried over when the campaign is stopped and restarted!

I will go ahead and open a bug report on GitHub with both cases documented. If either of you can share additional details, such as your exact upgrade path, cron job setup, or any relevant logs, it would help strengthen the report.

Report: Campaign restarts and repeatedly sends initial email after stop/republish · Issue #16133 · mautic/mautic · GitHub

Best,
Ricardo

Hi @ricfreire ,

thanks for opening a bug report on Github.

This morning I created the same campaign completely fresh to see if the error shows up again. No, it just worked as it should. Maybe this was because I set “Campaign Republish Behaviour” to “Restart on republish” right away. It seems if this is set, there are no emails send continuously.

As I need to create additional campaigns I also created a new campaign where I kept "“Campaign Republish Behaviour” set to “Use global settings”. To my surprise the campaign runs as it should, no endless emails.

The only thing I ever changed was to run the “doctrine:migration:migrate” command after I had created the first campaign, which had sent the endless emails. And of course, cloning the first campaign. One or both of these actions seem to have solved the entire issue.

Right now, I’m unable to reproduce the error.

Hope this helps to find what caused the issue in the first place.

All the Best,
Stephan