# Mautic says 'emails sent', but nothing has actually gone out

**URL:** <https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811>\
**Category:** Product Support\
**Created:** [April 24, 2023, 9:00pm UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811 "2023-04-24T21:00:50Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [April 24, 2023, 9:00pm UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/1 "2023-04-24T21:00:50Z")

</div>

**Your software**  
My Mautic version is: v4.4.7  
My PHP version is: 8  
My Database type and version is: MariaDB 10.3.38-MariaDB

**Your problem**  
My problem is:

Channels\>Emails says about 1100 emails have been sent, but nothing actually has gone out - 0 read, 0 bounced emails, etc.

I have been sending emails with this Mautic installation for years, but have never seen this. What could have happened? What should I check to troubleshoot?

I tried a small test mailing to a test segment with 3 of my own addresses. Same result; Mautic says ‘sent’, but nothing actually gone out. With ‘Send Example’, the email does arrive fine - email configuration still works.

These errors are showing in the log:

Which log…? Looking for it now…

‘Today’s Mautic error log is empty. Check server error log for error messages Mautic didn’t have a chance to catch.’

error\_log in the installation folder is empty.

Steps I have tried to fix the problem:

Don 't know where to start yet.

**Edit:**

[Based on this](https://forum.mautic.org/t/scheduled-emails-not-sent/17588/18), when Mautic says emails are sent, could it still mean the cronjob hasn’t run? Where is the limbo where these emails are stuck?

Could I send emails stuck in limbo with an SSH command? I’ve tried:

php bin/console mautic:emails:send

Something has now gone out. I’ve received one bounce message; it still does not look like a normal full mailing. Why did/do my emails get stuck in spool limbo?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [April 25, 2023, 4:09am UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/2 "2023-04-25T04:09:09Z")

</div>

Correct. They were all in the spool.

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [April 25, 2023, 5:57am UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/3 "2023-04-25T05:57:32Z")

</div>

Thanks. But why were they stuck there? Why didn’t they go out? What should I check/fix?

Only one or two emails have gone out now. Most of the mailing was lost, probably deleted from the server after a number of seconds you can set in Mautic configuration?

Mailings worked fine before. What broke/changed? I think my upgrade to PHP 8 was after my last successful mailing. Or did anything change in recent Mautic upgrades that requires email config or cronjob changes?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [April 25, 2023, 7:37am UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/4 "2023-04-25T07:37:10Z")

</div>

Hi,  
You need to test this:

1. check how many emails are in the pool.  
This command counts the files:  
`ls | wc`

2. If there are any try to run your `mautic:emails:send` command.  
Did it send out the emails?

- If yes, then this command is configured wrong in your crontab. (probably not the case). Check for typos.
- If no, then check error log.  
– Any related entries?  
– Do you get an error? For example some of the files cannot be read?  
– Do you see any files, with NOT .message extension?

1. If there are no emails in your spool folder, then make a test send and start from step 1.

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [April 25, 2023, 8:10am UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/5 "2023-04-25T08:10:23Z")

</div>

Thank you @joeyk !

This is an error that shows up in logs when I try to force send via the command line:

“rename(): supplied resource is not a valid Stream-Context resource”

[Someone here](https://forum.mautic.org/t/mautic-don-t-send-emails/25490) mentions the same error. I’ll look into this further later…

The initial sending attempt produces errors in logs [similar to these](https://www.hostpapa.com/knowledgebase/error-503-valid-rcpt-command-must-precede-data-outlook/) - Error 503: Valid RCPT command must precede DATA - but I’m confused if that applies to the recipient or my server. I have never had problems with SMTP authentication before and haven’t changed any settings.

Initial send attempt error in logs:

[2023-04-24 22:25:23] console.CRITICAL: Error thrown while running command “mautic:emails:send”. Message: "Expected response code 354 but got code “503”, with message "503-All RCPT commands were rejected with this error: 503-The mail server could not deliver mail to [jane.doe@recipient.co.uk](mailto:jane.doe@recipient.co.uk). 503-The account or domain may not exist, they may be blacklisted, or missing 503-the proper dns entries. 503 Valid RCPT command must precede DATA " Log data: \>\> . \<\< 250 OK id=1pr4cd-00043a-1E \>\> MAIL FROM:[mod@mydomainname.com](mailto:mod@mydomainname.com) \>\> RCPT TO:[another.recipient@website.org.uk](mailto:another.recipient@website.org.uk) \>\> DATA \<\< 250 OK \<\< 250 Accepted \<\< 354 Enter message, ending with “.” on a line by itself \>\> . \<\< 250 OK id=1pr4cd-00043a-23 \>\> … etc.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [April 28, 2023, 5:48am UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/6 "2023-04-28T05:48:45Z")

</div>

> [@modifiedcontent](#):
>
> rename(): supplied resource is not a valid Stream-Context resource

Sorry, no idea.

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [May 13, 2023, 1:57pm UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/7 "2023-05-13T13:57:00Z")

</div>

Working on this again this weekend, trying to restart my business from another stand-still. Sent out another mailing to a small test segment of other email addresses I own - gmail etc. Nothing arrives. No errors in logs.

Trying to force sending from command line with `php bin/console mautic:emails:send` gives this error:

```auto
In ProcessEmailQueueCommand.php line 141:

  rename(): supplied resource is not a valid Stream-Context resource

mautic:emails:send [--message-limit [MESSAGE-LIMIT]] [--time-limit [TIME-LIMIT]] [--do-not-clear] [--recover-timeout [RECOVER-TIMEOUT]] [--clear-timeout [CLEAR-TIMEOUT]] [--lock-name [LOCK-NAME]] [--bypass-locking] [-t|--timeout TIMEOUT] [-x|--lock_mode LOCK_MODE] [-f|--force] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

```

What is this rename() function? Where is it used in the process? How can I find out?

When I use `ls | wc` as suggested by @joeyk I get this as response:

```auto
26 26 309

```

What does that mean? If 26 or 309 is the number of emails in the pool/queue (?) that is way more than I would expect.

With `php bin/console mautic:messages:send` I get this response:

```auto
Processing message queue
Messages sent: 0

```

[The rename() error is also mentioned here](https://github.com/mautic/mautic/issues/10644) and [here](https://forum.mautic.org/t/mautic-don-t-send-emails/25490/8) - will research there further…

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [May 14, 2023, 12:45pm UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/8 "2023-05-14T12:45:50Z")

</div>

Line 141 in ProcessEmailQueueCommand.php is the following:

```auto
        //set spool message limit
        if ($msgLimit = $input->getOption('message-limit')) {
            $commandArgs['--message-limit'] = $msgLimit;
        } elseif ($msgLimit = $container->getParameter('mautic.mailer_spool_msg_limit')) {
            $commandArgs['--message-limit'] = $msgLimit;
        }

```

I don’t see `rename()` there, so where does that come in? What does ‘supplied resource is not a valid Stream-Context resource’ mean? How does this work together?

I have not made any changes to message limits configuration btw; sending worked fine before with the same settings.

[Here’s another one](https://forum.mautic.org/t/unable-to-send-queue-emails/21168/2) with the same error message. Unfortunately @mindeswx’s solution there does not work for me; I have always had that ‘Use owner as mailer’ setting set to ‘No’.

I guess to use `ls | wc` you have to change directory to the spool folder first? That is why I got unexpected results earlier I guess.

Where is the spool folder? Here according to Google:

> You should find it in either **/var/spool/mail/** (the traditional location) or /var/mail (new recommended location).

Could it be that the spool folder on my VPS was changed in an upgrade and that Mautic now can’t find the folder?

Result of `ls | wc` on /var/spool/mail/ is `0 0 0 `

Result of `ls | wc` on /var/mail/ is also `0 0 0 `

In both cases I would expect two emails that Mautic claims have been sent, but never arrived (in my test email boxes).

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [May 14, 2023, 10:45pm UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/9 "2023-05-14T22:45:35Z")

</div>

Mautic has its own spool dir., usually in /var/spool

If I would have to guess something interrupted the process and now some files are in invalid state.

Another option is that the spool folder/content has wrong owner (make sure is the same user as runs cronjob)

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [May 20, 2023, 10:32am UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/10 "2023-05-20T10:32:28Z")

</div>

Thanks @mzagmajster. There were a lot of .message files stuck (?) in that spool folder. I am deleting them now. How can files end up in an ‘invalid state’? What does that mean?

If there were an ownership mismatch between cronjob and spool, I should still have been able to send out the emails with `php bin/console mautic:emails:send`, right? So I think I can eliminate that issue?

I found the cron jobs I set up years ago in /var/spool/cron. Two of them look like this:

\*/3 \* \* \* \* /usr/local/bin/ea-php74 /home/myusername/public\_html/mautic/bin/console mautic:emails:send \>/dev/null 2\>&1

I guess `/ea-php74` could cause problems, since I have remove php7 and am on php8 now. Other lines have `/usr/local/bin/php`, so I’ll change it to that.

I also [saw this “error” in the logs](https://stackoverflow.com/questions/69925917/whm-exim-ses-smtp-error-we-do-not-authorize-the-use-of-this-system-to-tra). I am trying to send from an email address that is an addon/alias of the main domain on my server - always worked fine in the past. Maybe there is a handover or certificate problem there somewhere. I have tried to clean that up on my server, whitelist my IP address as allowed sender, etc.

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [May 21, 2023, 8:53am UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/11 "2023-05-21T08:53:10Z")

</div>

Like I said, something probably went wrong or the process got interrupted and as a result the script cannot pick up where it left of. From what you have provided its not possible to know how exactly it went wrong.

> [@modifiedcontent](#):
>
> If there were an ownership mismatch between cronjob and spool, I should still have been able to send out the emails with `php bin/console mautic:emails:send`, right? So I think I can eliminate that issue?

Not necessarily. It depends on which user on OS you use to send and how mautic permissions / ownership on the files is configured.

Mautic filesystem should be properly locked down and most of the files should only be readable from the webserver´s point of view.

Cronjob should run by the same user that runs the webserver.

I would stop all the sending from mautic create a test segment with just you as a contact and try to first send one email (to yourself). When this works I would again try to send to real contacts.

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [May 21, 2023, 12:13pm UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/12 "2023-05-21T12:13:08Z")

</div>

Thanks @mzagmajster. Having `ea-php74` in the cron job caused the problems - I had upgraded to php8 and removed 7 since the last mailing. After replacing it with `/usr/local/bin/php` the test mailing went through.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [May 23, 2023, 12:13am UTC](https://forum.mautic.org/t/mautic-says-emails-sent-but-nothing-has-actually-gone-out/27811/13 "2023-05-23T00:13:49Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
