I have been digging around in the perl library. This bug is caused by a bad QuotedPrint encoder. In CPAN, there are two Quoted printable encoders, and none of them work properly. Both of them strip blanks and new lines from the original file, thus making the attachment corrupt. I made my own version of the decode_qp function in MIME::QuotedPrint, and put it in place of the original one. It's working and no more corrupting my .pdf's and .dwg's.
BTW, does anybody know how to post a correction to code in CPAN?