• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Confirmed Email bouncing error

Affected version
2.0.1
#1
This error seems to be showing up in the logs quite frequently. I'm not entirely sure if it's at the fault of XF or how I have emails configured.

Zend\Mail\Exception\RuntimeException: Bounce message processing failed: Malformed header detected
src/vendor/zendframework/zend-mail/src/Headers.php:88


Stack Trace:

Code:
#0 src/vendor/zendframework/zend-mime/src/Decode.php(141): Zend\Mail\Headers::fromString('Return-Path: <6...', '\n')
#1 src/vendor/zendframework/zend-mail/src/Storage/Part.php(99): Zend\Mime\Decode::splitMessage('Return-Path: <6...', 'Return-Path: <6...', 'This is a multi...', '\n', false)
#2 src/vendor/zendframework/zend-mail/src/Storage/Message.php(54): Zend\Mail\Storage\Part->__construct(Array)
#3 src/XF/EmailBounce/Parser.php(168): Zend\Mail\Storage\Message->__construct(Array)
#4 src/XF/EmailBounce/Processor.php(69): XF\EmailBounce\Parser->parseMessage('Return-Path: <6...')
#5 src/XF/EmailBounce/Processor.php(53): XF\EmailBounce\Processor->processMessage('Return-Path: <6...')
#6 src/XF/Job/EmailBounce.php(27): XF\EmailBounce\Processor->processFromStorage(Object(Zend\Mail\Storage\Imap), 8)
#7 src/XF/Job/Manager.php(241): XF\Job\EmailBounce->run(8)
#8 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)
#9 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)
#10 job.php(15): XF\Job\Manager->runQueue(false, 8)
#11 {main}
Request State:

Code:
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(58) "https://fellowsfilm.co.uk/files/ukdt-cotterell.180/reviews"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 

Mike

XenForo developer
Staff member
#2
I have a feeling I know what this is as it may be a bug I reported in the underlying library we use, though it wasn't fixed until a version that we are currently unable to use. This is potentially the first time it's been seen in the wild though.

There should be at least one email in the bounce log at the same time as this error. The original value of that email should be logged (by clicking "view"). Can you send me that raw message? I should be able to test and reproduce the issue then.
 
#3
Code:
Return-Path: <>
Delivered-To: no-reply@fellowsfilm.co.uk
Received: from aristotle.versobit.net
    by aristotle.versobit.net with LMTP id WK18CtBsRVrhbgAAdT6w6g
    for <no-reply@fellowsfilm.co.uk>; Thu, 28 Dec 2017 17:14:40 -0500
Return-path: <>
Envelope-to: no-reply@fellowsfilm.co.uk
Delivery-date: Thu, 28 Dec 2017 17:14:40 -0500
Received: from mailnull by aristotle.versobit.net with local (Exim 4.89_1)
    id 1eUgRk-0007Nj-4o
    for no-reply@fellowsfilm.co.uk; Thu, 28 Dec 2017 17:14:40 -0500
Auto-Submitted: auto-replied
From: Mail Delivery System <Mailer-Daemon@aristotle.versobit.net>
To: no-reply@fellowsfilm.co.uk
Content-Type: multipart/report; report-type=delivery-status; boundary=1514499280-eximdsn-1562098278
MIME-Version: 1.0
Subject: Warning: message 1eTURX-0000jW-GM delayed 72 hours
Message-Id: <E1eUgRk-0007Nj-4o@aristotle.versobit.net>
Date: Thu, 28 Dec 2017 17:14:40 -0500

--1514499280-eximdsn-1562098278
Content-type: text/plain; charset=us-ascii

This message was created automatically by mail delivery software.
A message that you sent has not yet been delivered to one or more of its
recipients after more than 72 hours on the queue on aristotle.versobit.net.

The message identifier is:     1eTURX-0000jW-GM
The date of the message is:    Mon, 25 Dec 2017 15:13:30 +0000
The subject of the message is: Welcome to Fellowsfilm Network!

The address to which the message has not yet been delivered is:

  email@gmail.com
    host alt4.gmail-smtp-in.l.google.com [74.125.128.27]
    Delay reason: SMTP error from remote mail server after RCPT TO:<email@gmail.com>:
    452-4.2.2 The email account that you tried to reach is over quota. Please direct
    452-4.2.2 the recipient to
    452 4.2.2  https://support.google.com/mail/?p=OverQuotaTemp f13si6152533edm.455 - gsmtp

No action is required on your part. Delivery attempts will continue for
some time, and this warning may be repeated at intervals if the message
remains undelivered. Eventually the mail delivery software will give up,
and when that happens, the message will be returned to you.

--1514499280-eximdsn-1562098278
Content-type: message/delivery-status

Reporting-MTA: dns; aristotle.versobit.net

Action: delayed
Final-Recipient: rfc822;email@gmail.com
Status: 4.0.0
Remote-MTA: dns; alt4.gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 452-4.2.2 The email account that you tried to reach is over quota. Please direct
452-4.2.2 the recipient to
452 4.2.2  https://support.google.com/mail/?p=OverQuotaTemp f13si6152533edm.455 - gsmtp

--1514499280-eximdsn-1562098278
Content-type: text/rfc822-headers

Return-path: <no-reply@fellowsfilm.co.uk>
Received: from [192.99.39.70] (port=38816 helo=fellowsfilm.co.uk)
    by aristotle.versobit.net with esmtpsa (TLSv1:ECDHE-RSA-AES128-SHA:128)
    (Exim 4.89_1)
    (envelope-from <no-reply@fellowsfilm.co.uk>)
    id 1eTURX-0000jW-GM
    for email@gmail.com; Mon, 25 Dec 2017 10:13:31 -0500
Message-ID: <36b5fa78860204b911001cb4c36cb142@fellowsfilm.co.uk>
Date: Mon, 25 Dec 2017 15:13:30 +0000
Subject: Welcome to Fellowsfilm Network!
From: Fellowsfilm Team <no-reply@fellowsfilm.co.uk>
To: user <email@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="_=_swift_v4_1514214810_6bdc48fe44c19aaf9b71a09eae2aaac4_=_"
X-To-Validate: 708c8c98+email@gmail.com


--1514499280-eximdsn-1562098278--
 
Last edited by a moderator:

Mike

XenForo developer
Staff member
#4
In hindsight, I don't think that was the email that actually triggered this issue as it seems to parse without a problem in my tests.

However, I did have a test case for this so I have added some code that I believe should prevent this in 2.0.2.
 
#5
Just got this error again running 2.0.2:
Zend\Mail\Exception\RuntimeException: Bounce message processing failed: Malformed header detected
src/vendor/zendframework/zend-mail/src/Headers.php:88


Code:
#0 src/vendor/zendframework/zend-mime/src/Decode.php(141): Zend\Mail\Headers::fromString('Return-Path: <k...', '\n')
#1 src/vendor/zendframework/zend-mail/src/Storage/Part.php(99): Zend\Mime\Decode::splitMessage('Return-Path: <k...', 'Return-Path: <k...', '--001a114b3346b...', '\n', false)
#2 src/vendor/zendframework/zend-mail/src/Storage/Message.php(54): Zend\Mail\Storage\Part->__construct(Array)
#3 src/XF/EmailBounce/Parser.php(169): Zend\Mail\Storage\Message->__construct(Array)
#4 src/XF/EmailBounce/Processor.php(69): XF\EmailBounce\Parser->parseMessage('Return-Path: <k...')
#5 src/XF/EmailBounce/Processor.php(53): XF\EmailBounce\Processor->processMessage('Return-Path: <k...')
#6 src/XF/Job/EmailBounce.php(27): XF\EmailBounce\Processor->processFromStorage(Object(Zend\Mail\Storage\Imap), 7.9999861717224)
#7 src/XF/Job/Manager.php(241): XF\Job\EmailBounce->run(7.9999861717224)
#8 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 7.9999861717224)
#9 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 7.9999861717224)
#10 job.php(15): XF\Job\Manager->runQueue(false, 8)
#11 {main}
Code:
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(65) "https://fellowsfilm.co.uk/threads/yorkshire-counties.3330/page-25"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 

Mike

XenForo developer
Staff member
#6
Can you try to identify the email that error relates to? We'd need to be able to reproduce it.

On the face of it, this looks like an invalid email (or a bug in the underlying email parsing library we use).
 

Chris D

XenForo developer
Staff member
#8
Unfortunately this is a manifestation of a bug in zend-mail or zend-mime as far as I can see.

It relates to this issue:
https://github.com/zendframework/zend-mail/issues/92

However, specifically, it would appear to be exasperated by the specific format of the bounce message. Arguably it is not invalid, as per this: https://tools.ietf.org/html/rfc7103#section-7.3

But it would appear to be things like this:

1519391066988.png

The double line break there is problematic. A double line break in the mail header indicates the headers are finished, but in this case they're not.

That doesn't appear to be the only issue though. If the dodgy line breaks are removed, it falls over elsewhere.

I don't have an immediate workaround unfortunately.