# Script to replace the mautic:emails:send cronjob

**URL:** <https://forum.mautic.org/t/script-to-replace-the-mauticsend-cronjob/29624>\
**Category:** General Discussion\
**Created:** [October 11, 2023, 6:02pm UTC](https://forum.mautic.org/t/script-to-replace-the-mauticsend-cronjob/29624 "2023-10-11T18:02:15Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![sfahrenkrog1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/sfahrenkrog1/32/4583_2.png) [@sfahrenkrog1](https://forum.mautic.org/u/sfahrenkrog1)\
**Post date:** [October 13, 2023, 8:39am UTC](https://forum.mautic.org/t/script-to-replace-the-mauticsend-cronjob/29624/7 "2023-10-13T08:39:02Z")

</div>

Hey Joey

There was a merged pull request regarding this multi threading sending:

> <https://github.com/mautic/mautic/pull/9089>
>
> \<!--
> Any PR related to Mautic 2 issues is not relavant anymore, please consider… upgrading your code to the Mautic 3 series (staging/3.0 branch).
> \--\>
> | Q | A
> | -------------------------------------- | ---
> | Branch? | staging
> | Bug fix? | no
> | New feature? | yes
> | Deprecations? | no
> | BC breaks? | no
> | Automated tests included? | yes
> | Related user documentation PR URL | mautic/mautic-documentation#... 
> | Related developer documentation PR URL | mautic/developer-documentation#... 
> | Issue(s) addressed | Fixes #... 
> 
> \<!--
> Additionally (see https://contribute.mautic.org/contributing-to-mautic/developer/code/pull-requests#step-5-work-on-your-pull-request):
> - Always add tests and ensure they pass.
> - Bug fixes must be submitted against the lowest maintained branch where they apply
> (lowest branches are regularly merged to upper ones so they get the fixes too.)
> - Features and deprecations must be submitted against the staging branch.
> \--\>
> 
> \<!--
> Please write a short README for your feature/bugfix. This will help people understand your PR and what it aims to do.
> \--\>
> \#### Description:
> This PR is fixes the failed tests for PR https://github.com/mautic/mautic/pull/8617
> 
> \> Add lock-name option on 'mautic:emails:send' command. This option allow to have serval email send process running in same time with different lock name.
> \> 
> \> A swiftmailler bug is fixed in this PR swiftmailer/swiftmailer#1270 to avoid send the same email twice. This modification should come with next M3 composer update.
> \> 
> 
> \<!--
> If you are fixing a bug and if there is no linked issue already, please provide steps to reproduce the issue here.
> \--\>
> 
> \#### Steps to test this PR:
> 1. Load up \[this PR\](https://mautibox.com)
> 2. 
> 
> \<!--
> If you have any deprecations, list them here along with the new alternative.
> If you have any backwards compatibility breaks, list them here.
> \--\>

Relevant part is this info from kuzmany:

 ![Bildschirmfoto 2023-10-13 um 10.33.21](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/5/563f286ac245c1af2640bdbfdfb3ff46d4adaa35.png)

The thing is I don’t know if this ever happened in mautic swiftmailer:

> Also need fix in swiftmailer [Add flock lock on message during queue flushing by Dcoutelle · Pull Request #1270 · swiftmailer/swiftmailer · GitHub](https://github.com/swiftmailer/swiftmailer/pull/1270/files)

So maybe a patched is needed.

This would be the patch:  
[https://patch-diff.githubusercontent.com/raw/swiftmailer/swiftmailer/pull/1270.diff](https://patch-diff.githubusercontent.com/raw/swiftmailer/swiftmailer/pull/1270.diff)

So I think this patch is still needed (Because I apply in mautic 4.4.10 and it was applied cleanly)

To apply just do in the mautic root:

```auto
cd vendor/swiftmailer/swiftmailer
curl -L https://patch-diff.githubusercontent.com/raw/swiftmailer/swiftmailer/pull/1270.diff | git apply -v

```

Should output something like:

> Checking patch lib/classes/Swift/FileSpool.php…
> 
> Applied patch lib/classes/Swift/FileSpool.php cleanly.

---

_[View the full topic](https://forum.mautic.org/t/script-to-replace-the-mauticsend-cronjob/29624)._
