Partial fix Not a valid Mime Message

Anthony Parsons

Well-known member
Periodically get this error message logged, not sure if its a bug or not... just letting you know. Latest XF version, happened with .11 too.

Error Info
Zend_Exception: Not a valid Mime Message: End Missing - library/Zend/Mime/Decode.php:72
Generated By: Unknown Account, Yesterday at 1:23 AM
Stack Trace
#0 /home/ptsdforu/public_html/c/library/Zend/Mime/Decode.php(92): Zend_Mime_Decode::splitMime('%%uncomment VAR...', '6627adf2b1f85eb...')
#1 /home/ptsdforu/public_html/c/library/Zend/Mail/Part.php(222): Zend_Mime_Decode::splitMessageStruct('%%uncomment VAR...', '6627adf2b1f85eb...')
#2 /home/ptsdforu/public_html/c/library/Zend/Mail/Part.php(292): Zend_Mail_Part->_cacheContent()
#3 /home/ptsdforu/public_html/c/library/Zend/Mail/Part.php(517): Zend_Mail_Part->countParts()
#4 /home/ptsdforu/public_html/c/library/XenForo/BounceParser.php(182): Zend_Mail_Part->rewind()
#5 /home/ptsdforu/public_html/c/library/XenForo/BounceParser.php(170): XenForo_BounceParser->_process()
#6 /home/ptsdforu/public_html/c/library/XenForo/Model/EmailBounce.php(12): XenForo_BounceParser->__construct(Object(Zend_Mail_Message), 'ptsdforu@myptsd...', '4e6829c3668f26d...')
#7 /home/ptsdforu/public_html/c/library/XenForo/Deferred/EmailBounce.php(52): XenForo_Model_EmailBounce->processBounceEmail('Return-Path: <2...')
#8 /home/ptsdforu/public_html/c/library/XenForo/Model/Deferred.php(295): XenForo_Deferred_EmailBounce->execute(Array, Array, 7.9999990463257, '')
#9 /home/ptsdforu/public_html/c/library/XenForo/Model/Deferred.php(429): XenForo_Model_Deferred->runDeferred(Array, 7.9999990463257, '', false)
#10 /home/ptsdforu/public_html/c/library/XenForo/Model/Deferred.php(374): XenForo_Model_Deferred->_runInternal(Array, 8, '', false)
#11 /home/ptsdforu/public_html/c/deferred.php(23): XenForo_Model_Deferred->run(false)
#12 {main}
Request State
array(3) {
  ["url"] => string(37) ""
  ["_GET"] => array(0) {
  ["_POST"] => array(3) {
   ["_xfRequestUri"] => string(65) "/c/threads/anyone-else-have-trouble-imagining-their-future.34342/"
   ["_xfNoRedirect"] => string(1) "1"
   ["_xfResponseType"] => string(4) "json"


XenForo developer
Staff member
There's a bit of a catch 22 here as we remove the message before processing it to prevent an infinite loop in the case of an error (like the one happening here). As such, I'm not sure if you can get access to the raw version of the message, but unfortunately I would need that to do any debugging. Depending on the mail server, the email may still be maintained in a trash folder. If not, we could potentially make a tweak to log every email to see if we could get access to it then.


XenForo developer
Staff member
This is bounce handling, so it relates to incoming mail (into your bounce PHP3/IMAP account). If you log into that account, do you see any messages in a trash folder?


XenForo developer
Staff member
I've made some changes in the next release to at least make debugging easier: we now log the email even if we fail to parse it. It will still log an exception to bring it to your attention, though it won't interfere with us reading from the mailbox like it does currently (until the next cron run).

However, if these are truly invalid emails like I suspect, we won't be able to process them anyway. You may be able to pull the data out manually. Hopefully it's not common and was just related to a bug in some MTA generating the bounce emails.

So going to call this a partial fix. If it happens again (1.5.13+), then we can investigate in more detail.


Well-known member
I am getting multiple of these a day. I may be wrong but is it possible that this is become more prevalent after 1.5.13 upgrade?