Sending Scheduled Emails works intermittently

Your software
My Mautic version is: 2.15.2
My PHP version is: 7.2

Your problem
My problem is: While scheduling emails in an existing campaign, sometimes the emails are sent, sometimes the emails are not.

These errors are showing in the log: No errors in the log

Steps I have tried to fix the problem: I have tried changing the type of mail from marketing to transactional multiple times, also tried with new emails incase same email is causing issues.

Adding a new user to the segment seems to trigger the sending of scheduled emails. This however could just be a coincidence.

Edit: Added last line

Hi @adityaj and welcome to the Community Forums! :tada:

Please see this github issue which sounds like your problem: https://github.com/mautic/mautic/issues/7767

and the associated PR to fix: https://github.com/mautic/mautic/pull/7807

Please comment on the PR if this resolves your issue!

Thanks @ruth.cheesly, I forgot to mention that I have already applied that patch.

Did you see the error mentioned in the PR in your logs before you applied the patch?

Do you see any errors in the log now? Can you share them?

Have you got any emails in your spool that are waiting to be sent?

Can you see any commonality with the ones that are being sent, and the ones which are not being sent?

[2019-09-02 14:12:41] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: "You have requested a non-existent service "swiftmailer.mailer.transport.sendmail"." at /opt/mautic2/vendor/symfony/dependency-injection/Container.php line 288 {"exception":"[object] (Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException(code: 0): You have requested a non-existent service \"swiftmailer.mailer.transport.sendmail\". at /opt/mautic2/vendor/symfony/dependency-injection/Container.php:288)"} []

[2019-09-02 14:13:51] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: “You have requested a non-existent service “swiftmailer.mailer.transport.sendmail”.” at /opt/mautic2/vendor/symfony/dependency-injection/Container.php line 288 {“exception”:"[object] (Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException(code: 0): You have requested a non-existent service “swiftmailer.mailer.transport.sendmail”. at /opt/mautic2/vendor/symfony/dependency-injection/Container.php:288)"}
[2019-09-02 14:15:31] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: “You have requested a non-existent service “swiftmailer.mailer.transport.sendmail”.” at /opt/mautic2/vendor/symfony/dependency-injection/Container.php line 288 {“exception”:"[object] (Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException(code: 0): You have requested a non-existent service “swiftmailer.mailer.transport.sendmail”. at /opt/mautic2/vendor/symfony/dependency-injection/Container.php:288)"}
[2019-09-02 14:17:41] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: “You have requested a non-existent service “swiftmailer.mailer.transport.sendmail”.” at /opt/mautic2/vendor/symfony/dependency-injection/Container.php line 288 {“exception”:"[object] (Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException(code: 0): You have requested a non-existent service “swiftmailer.mailer.transport.sendmail”. at /opt/mautic2/vendor/symfony/dependency-injection/Container.php:288)"}
[2019-09-02 14:21:51] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: “You have requested a non-existent service “swiftmailer.mailer.transport.sendmail”.” at /opt/mautic2/vendor/symfony/dependency-injection/Container.php line 288 {“exception”:"[object] (Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException(code: 0): You have requested a non-existent service “swiftmailer.mailer.transport.sendmail”. at /opt/mautic2/vendor/symfony/dependency-injection/Container.php:288)"}

This is a recent error after I changed the sending service from sendgrid to sendmail.

Screenshot%20from%202019-09-02%2019-55-34

this is how the campaign looks. Emails are triggered for few but not all users.
Also, once a new user is added all scheduled emails are sent to the user, which can be overwhelming.

$ ls -1 ../spool/default/ | wc -l
0

My spool is empty.

Here is the step by step process that I followed:

  1. Create an email
  2. Create a segment with contacts
  3. Create a campaign with this email and segment.
  4. Send a scheduled email. --> This works.
  5. Add a new email.
  6. Edit the campaign to schedule this new email. --> This does not work.
  7. Add a new user to the campaign --> Both first and second emails are received by this user.