# Sending Scheduled Emails works intermittently

**URL:** <https://forum.mautic.org/t/sending-scheduled-emails-works-intermittently/11039>\
**Category:** Product Support\
**Created:** [September 2, 2019, 1:51pm UTC](https://forum.mautic.org/t/sending-scheduled-emails-works-intermittently/11039 "2019-09-02T13:51:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adityaj](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/adityaj/32/494_2.png) [@adityaj](https://forum.mautic.org/u/adityaj)\
**Post date:** [September 2, 2019, 1:51pm UTC](https://forum.mautic.org/t/sending-scheduled-emails-works-intermittently/11039/1 "2019-09-02T13:51:46Z")

</div>

**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

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [September 2, 2019, 2:05pm UTC](https://forum.mautic.org/t/sending-scheduled-emails-works-intermittently/11039/2 "2019-09-02T14:05:24Z")

</div>

Hi @adityaj and welcome to the Community Forums! 🎉

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

and the associated PR to fix: [https://github.com/mautic/mautic/pull/7807](https://github.com/mautic/mautic/pull/7807)

Please comment on the PR if this resolves your issue!

---

<div class="post-metadata">

**Author:** ![adityaj](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/adityaj/32/494_2.png) [@adityaj](https://forum.mautic.org/u/adityaj)\
**Post date:** [September 2, 2019, 2:21pm UTC](https://forum.mautic.org/t/sending-scheduled-emails-works-intermittently/11039/3 "2019-09-02T14:21:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [September 2, 2019, 2:24pm UTC](https://forum.mautic.org/t/sending-scheduled-emails-works-intermittently/11039/4 "2019-09-02T14:24:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![adityaj](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/adityaj/32/494_2.png) [@adityaj](https://forum.mautic.org/u/adityaj)\
**Post date:** [September 2, 2019, 2:32pm UTC](https://forum.mautic.org/t/sending-scheduled-emails-works-intermittently/11039/5 "2019-09-02T14:32:47Z")

</div>

```
[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](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/0d3119b9a155980382c4c75d2ffc98ac733f57bd.png)

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.
