|P is for Practical|
Re: decoding email attachments.by flexvault (Monsignor)
|on Mar 03, 2013 at 12:14 UTC||Need Help??|
I'm not familiar with Net::IMAP:Client, but I have written a full email package in Perl for a web mail system, and that series of packages took 2+ years to develop and I already had 10+ years working with email and Perl. I recommend that you get a copy of an O'Reilly book called "Programming Internet Email" written by David Wood. I got my copy used, but it was a great help in answering so many basic/advanced email questions. The most important part is that the examples are written in Perl (and Java), and Perl is what I needed. Also what helped me was the explanation of the terms and the rules for building a RFC compliant email.
Now I'm going to guess how to help you.
Once you use MIME, the format of the email document changes. Every part of the email is now controlled by '"Content-Type: ... boundary="..."'. Even the Capitalization of words used in the headers is mandatory.
Now guessing, the parts of the "body" (which could be a series of nested multi-part messages) needs to be encoded without the headers and the headers have to be separated by two "\r\n" before and after the encoded message. So you need to make sure the boundary headers are not part of the encoded document.
I use the free Mozilla Thunderbird and if you display a MIME email and then type '^U' (control U), you will see how the raw email is received by Thunderbird. This can help you determine if your generated email looks like the one generated by Thunderbird. I found other clients show the translated email and not the raw input.
"Well done is better than well said." - Benjamin Franklin