Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: decoding email attachments.

by flexvault (Parson)
on Mar 03, 2013 at 12:14 UTC ( #1021495=note: print w/ replies, xml ) Need Help??

in reply to decoding email attachments.

Welcome tenny1204,

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.

Good Luck...Ed

"Well done is better than well said." - Benjamin Franklin

Comment on Re: decoding email attachments.
Re^2: decoding email attachments.
by tenny1204 (Novice) on Mar 04, 2013 at 12:34 UTC

    Thank you for replying. I hope someday i will be able to make use of what you just told me. But in order to finish my program i've decided to parse the entire message, and work with that. Save the decoding/encoding for later. Best regards.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021495]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2014-08-01 11:55 GMT
Find Nodes?
    Voting Booth?

    Who would be the most fun to work for?

    Results (10 votes), past polls