Fixed Empty return path on bounce handler throws error.

Slavik

XenForo moderator
Staff member
Affected version
2.0
Code:
Server error log
Zend\Mail\Exception\InvalidArgumentException: Bounce message processing failed: The input exceeds the allowed length src/vendor/zendframework/zend-mail/src/Address.php:77
Generated by: Unknown account Feb 18, 2019 at 12:53 PM
Stack trace
#0 src/vendor/zendframework/zend-mail/src/Address.php(53): Zend\Mail\Address->__construct('draft+bounced+f...', NULL, '')
#1 src/vendor/zendframework/zend-mail/src/Header/AbstractAddressList.php(86): Zend\Mail\Address::fromString('draft+bounced+f...', '')
#2 [internal function]: Zend\Mail\Header\AbstractAddressList::Zend\Mail\Header\{closure}('draft+bounced+f...')
#3 src/vendor/zendframework/zend-mail/src/Header/AbstractAddressList.php(65): array_map(Object(Closure), Array)
#4 src/vendor/zendframework/zend-mail/src/Headers.php(484): Zend\Mail\Header\AbstractAddressList::fromString('To: draft+bounc...')
#5 src/vendor/zendframework/zend-mail/src/Headers.php(231): Zend\Mail\Headers->loadHeader('To: draft+bounc...')
#6 src/vendor/zendframework/zend-mail/src/Headers.php(95): Zend\Mail\Headers->addHeaderLine('To: draft+bounc...')
#7 src/vendor/zendframework/zend-mime/src/Decode.php(149): Zend\Mail\Headers::fromString('Return-Path: <>...', '
')
#8 src/vendor/zendframework/zend-mail/src/Storage/Part.php(102): Zend\Mime\Decode::splitMessage('Return-Path: <>...', 'Return-Path: <>...', 'This is a MIME-...', '
', false)
#9 src/vendor/zendframework/zend-mail/src/Storage/Message.php(52): Zend\Mail\Storage\Part->__construct(Array)
#10 src/XF/EmailBounce/Parser.php(169): Zend\Mail\Storage\Message->__construct(Array)
#11 src/XF/EmailBounce/Processor.php(69): XF\EmailBounce\Parser->parseMessage('Return-Path: <>...')
#12 src/XF/EmailBounce/Processor.php(53): XF\EmailBounce\Processor->processMessage('Return-Path: <>...')
#13 src/XF/Job/EmailBounce.php(27): XF\EmailBounce\Processor->processFromStorage(Object(Zend\Mail\Storage\Imap), G)
#14 src/XF/Job/Manager.php(253): XF\Job\EmailBounce->run(G)
#15 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#16 src/XF/Job/Manager.php(79): XF\Job\Manager->runJobEntry(Array, G)
#17 job.php(42): XF\Job\Manager->runQueue(false, 8)
#18 {main}

Seems related to https://github.com/zendframework/zend-mail/issues/83
 
Yeah I think the issue here is actually what it's reporting which is the length is too long.

Zend Mail is super strict in almost everything it does, almost to a fault. I think it's detecting that the address in the To: header is too long. This may well actually be the length of the VERP address we've created for the bounce, but there's not a lot we can do about that.

Ultimately I think we just need to silence any errors about certain things. But it's a pain when it's embedded so deep within a vendor package. I think there's a few workarounds though.
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.1).

Change log:
When validating email addresses when handling email bounces, do so in a non-strict mode and ignore minor errors.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom