XF 2.3 Queued mail failed to be sent due to a mail_data error

Old Nick

Well-known member
What's wrong with my settings ?

Code:
ErrorException: Queued mail failed to be sent due to a mail_data error. The queued email entry has been deleted. src/XF/Error.php:79

Code:
#0 src/XF.php(225): XF\Error->logError('Queued mail fai...', false)
#1 src/XF/Job/MailSend.php(33): XF::logError('Queued mail fai...')
#2 src/XF/Job/Manager.php(272): XF\Job\MailSend->run(7.30551)
#3 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 7.30551)
#4 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 7.30551)
#5 job.php(43): XF\Job\Manager->runQueue(false, 8)
#6 {main}

Code:
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(82) "https://*********.net/discussions/organisation-du-forum-categories-et-rubriques.1/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

Thx
 
Solution
The emails won't be delivered either way unfortunately. If you're feeling adventurous you can just remove this from src/XF/Job/MailSend.php for now:

PHP:
        if (!($email instanceof Email))
        {
            if (\XF::$debugMode)
            {
                \XF::logError('Queued mail failed to be sent due to a mail_data error. The queued email has been logged to xf_failed_job.');
                return $this->fail();
            }

            \XF::logError('Queued mail failed to be sent due to a mail_data error. The queued email entry has been deleted.');
            return $this->complete();
        }
I use an alias created with Cloudflare so in principle they are the ones who manage the entire process. I have not configured any SMTP profile in the ACP, I use the integrated PHP solution and the email sending test is successful.
 
Where can i find them?
You'll need to check your PHP configuration settings to know whether and where it's logging inbuilt mail functionality.
phpmail.log in your screenshot looks obvious, so perhaps it's not logging or you have no issues to log.
If no issues to log, then you next to check next step configuration to see how/where php inbuilt mail is sending your mails for delivery.
 
I'm on a shared server so I probably don't have access to this type of information. In fact it is the notification emails that are the problem, if I use the contact form this produces no error and the email is correctly sent to the recipient.
 
In fact it is the notification emails that are the problem, if I use the contact form this produces no error and the email is correctly sent to the recipient.
They use the same mail transport process, so it's thusly not an XF issue but one with your mail delivery services.
As said, you'll need to check logs and delivery config. If that's not available to you, you can either get your host support to review/investigate or change to using a 3rd party SMTP service for your mail delivery.
 
So I have to look at Cloudflare? They are the ones who manage all of this since I use an address/alias created with them.
It's surprising that it works on one side and not the other if it's the same transport process that manages...

I am a little lost. Thanks for your help, I'll see what I can do.
 
Is this a recurring issue? This error actually implies that something other than a valid email object wound up in your mail queue. Nothing to do with your mail settings. It's possible an add-on, or potentially even some old lingering XF 2.2 mails in the queue (though I think we try to handle those on upgrade).
 
Is this a recurring issue? This error actually implies that something other than a valid email object wound up in your mail queue. Nothing to do with your mail settings. It's possible an add-on, or potentially even some old lingering XF 2.2 mails in the queue (though I think we try to handle those on upgrade).
I installed just one add-on, [Digitalpoint]Cloudflare, I did a test by disabling it and the error still occurs.
Otherwise it is a recent installation directly with 2.3 RC2
 
Do you have DKIM signing enabled in XF? And if so, does disabling that make the error stop? If so, please file a bug report.
Ok, by disabling DKIM in the ACP the error no longer occurs. However, the email is not received by the recipient. Sending the email using the contact form still works correctly.
 
The emails won't be delivered either way unfortunately. If you're feeling adventurous you can just remove this from src/XF/Job/MailSend.php for now:

PHP:
        if (!($email instanceof Email))
        {
            if (\XF::$debugMode)
            {
                \XF::logError('Queued mail failed to be sent due to a mail_data error. The queued email has been logged to xf_failed_job.');
                return $this->fail();
            }

            \XF::logError('Queued mail failed to be sent due to a mail_data error. The queued email entry has been deleted.');
            return $this->complete();
        }
 
Solution
This will simply remove error logging, correct?
So if I leave DKIM activated, there is no chance of having emails sent and especially received, right? It's not very serious at the moment knowing that my forum is new and without members. So I will wait for a fix from you in the next versions of XF. Thanks for your help.
 
No, it will remove the erroneous check that causes an otherwise normal situation to be considered an error and allow the DKIM-signed emails to be delivered normally. A more comprehensive fix will retain the error logging without getting tripped up by this.
 
Back
Top Bottom