Attachment Corruption in Outlook - FIX

Discussion in 'Using your helpdesk' started by scravid, Jan 14, 2011.

  1. scravid

    scravid Established Member

    Attachment Corruption in Outlook - Need FIX

    Hi All,

    After much head scratching (and support from the guys at Kayako), I have arrived at a much needed fix for a problem I was seeing.

    The issue we have now resolved concerned new tickets which happened to have attachments. They worked fine when accessed through the helpdesk system (Staff interface), but when our Coordinator forwarded out the ticket, the attachments would come through on Outlook (2003, 2007 and 2010) as totally corrupt.

    Kayako support helped establish it was an Outlook based problem since it worked fine with Gmail, so after that we were on our own!

    After some searching, we decided it might be related to XMailer and had a good search around their forums. This was the result and indeed the fix

    XPertMailer Forum

    Hope this helps someone else too :D

    Scravid
     
  2. scravid

    scravid Established Member

    Hmm, update on this.

    Changing the MLEN constant seems to have broken some other emails from the system. I had to switch it back.

    Anyone at Kayako got a fix for this? I don't think we'll get anything from Xmailler since it looks ancient.
     
  3. sallebasjan

    sallebasjan Established Member

    Bumping this. I have the same problem and kayako need's to investigate their base64 encoding of attachments asap! Other clients might be more forgiving of the encoding than outlook!
     
  4. trrunde

    trrunde Established Member

    We are also having trouble with corrupt attachements. What file did you change?
     
  5. sallebasjan

    sallebasjan Established Member

    On line 30 in __swift/thirdparty/XPM/PHP5/MIME5.php Max body line length should be set to 76 and not 70. According to base64 standard's max length is 76, so I don't know why kayako has set this to 70. I've even tried to get this info from kayako support without any proper response since they claim it's a outlook/exchange problem.

    ref:
    http://en.wikipedia.org/wiki/Base64
    Look for: Base64 transfer encoding for MIME(RFC 2045) -> Max line length.

    FYI..
    After changing the above MLEN to 76 all attachments sent from kayako are OK.
     
    trrunde likes this.
  6. trrunde

    trrunde Established Member

    Thank you! :) this works excellent!
     
  7. trrunde

    trrunde Established Member

    Checked the changelog, guessing they changed the setting in version .199


    ryanlederman
    199
    21 March 2011 10:53 PM-- Parser
    - SWIFT-1192: MIME headers of outgoing email are corrupt or mail does not get delivered at all
    M: /trunk/__swift/thirdparty/XPM/PHP5/MAIL5.php
    M: /trunk/__swift/thirdparty/XPM/PHP5/MIME5.php
     
  8. trrunde

    trrunde Established Member

    I compared the file with MIME5.php from version 4.1.176, and this file is also set with the wrong setting:
    class MIME5 {

    const LE = "\r\n";
    const HLEN = 52;
    /**
    * ---------------------------------------------
    * [MODIFICATION]: Fix for Corrupt Attachments Issue [Varun]
    * http://www.xpertmailer.com/forum/viewtopic.php?p=113&highlight=&sid=d7767a569fd0d543737bc622ed2510a1
    * http://www.xpertmailer.com/forum/se...rostfire&sid=89a9fb1bd1c65e4744f66dc60f3424dd
    * ---------------------------------------------
    */
    const MLEN = 72;

    const HCHARSET = 'utf-8';
    const MCHARSET = 'us-ascii';

    const HENCDEF = 'quoted-printable';
    const MENCDEF = 'quoted-printable';

    static public $hencarr = array('quoted-printable' => '', 'base64' => '');
    static public $mencarr = array('7bit' => '', '8bit' => '', 'quoted-printable' => '', 'base64' => '', 'binary' => '');

    I wonder why I didnt get this error in version 4.1.176 when the setting is wrong....
     
  9. sallebasjan

    sallebasjan Established Member

    As I said I haven't gotten any response as to why Kayako have set this MLEN variable to 70, so to set this value to 76 is at your own risk, but so far it has been working flawlessly.

    Maybe someone at kayako can comment this thread and clarify?
     
  10. jacklod

    jacklod New Member

    Thank you! :) this works excellent!
     
  11. scravid

    scravid Established Member

    Nice one!

    Just found this was happening again and changed my MLEN to 76.

    That looks to have sorted it nicely.

    Thanks all.
     
  12. enrise

    enrise Established Member

    The fix by sallebasjan worked for me as well! Thnx
     
  13. enrise

    enrise Established Member

    This would be nice, maybe changing the setting might cause problems. Haven't noticed them so far however
     
  14. stophi

    stophi Member

    I saw in version 4.01.240 the problem is still not fixed.

    any feedback from kayako regarding this bug?

    thx
     
  15. Jamie Edwards

    Jamie Edwards Chief Limey Staff Member

    This has been fixed in 4.01.325, available now
     
  16. stophi

    stophi Member

    thank you very much for your feedback.
    I think I will upgrade soon ;-)
     
  17. Jamie Edwards

    Jamie Edwards Chief Limey Staff Member

    Sorry, I posted that in the wrong thread. It may not yet be fully resolved in the latest version. I'll check it out and update you
     
  18. stophi

    stophi Member

    hmmm - ok
    so we still have to fix after upgrade with "On line 30 in __swift/thirdparty/XPM/PHP5/MIME5.php Max body line length should be set to 76 and not 70."
     
  19. Gary McGrath

    Gary McGrath Staff Member

    I don't think the XPM fix will work, as the new version switches from XPM to swiftmail.

    Gary
     
  20. sallebasjan

    sallebasjan Established Member

    A quick search gives out:

    if (0 >= $maxLineLength || 76 < $maxLineLength)
    {
    $maxLineLength = 76;

    from __swift\thirdparty\SwiftMailer\classes\SwiftMailer\Encoder\Base64Encoder.php

    Does anyone have this problem in .649?
     

Share This Page