PugSA has asked for the wisdom of the Perl Monks concerning the following question:
Hi Fellow monks
I was abruptly referred to How (Not) To Ask A Question. last week, deservedly so.
Thank You.
After reading the document I appreciate much more of what is going on in the forum. I'll do my best in staying with the rules.
First of all I'm working on windows. I was given the task of retrieving a email from a specific email address and saving as a file in any outlook compattible format, for example as a (.msg) or (.eml) file. I can download the email and save it as a text file. The attachments or refferred to in the MIME tools as 'slang for any part of a multipart message' is still encoded.
I'm a bit clueless on the usage of the MIME tools although I've read through most of the MIME documentation. I'm not to sure if it is just lack in experience or a lack of undestanding of the english language. (but all excuses aside my code will explain better).
I'm also not sure if MIME is the way to go to get the whole message in a outlook compattible format. If you could please advise.
#!c:\perl\bin use Net::POP3; use MIME::Parser ; my $parser = new MIME::Parser; my $pophost = myhost'; # Name or IP address of POP3 server my $popuser = myusr; # Account name on POP3 server my $poppass = mypass; # Password for account my ($item,$message,$line); my $pop = Net::POP3->new($pophost) or die "$!\n"; my $message_list = $pop->list; if ($pop->login($popuser, $poppass) > 0) { my $msgnums = $pop->list; # hashref of msgnum => size foreach my $msgnum (keys %$msgnums) { my $msg = $pop->get($msgnum); ##Comment 1 #$fname = $msgnum.".txt"; #open(MAIL,">$fname"); #print MAIL @$msg; #close MAIL; ##Comment2 #$parser->output_dir("/tmp"); #$parser->output_prefix("msg"); #$parser->output_to_core(1); my $entity = $parser->parse(@$msg); ##Comment3 #$pop->delete($msgnum); } } $pop->quit;
Comment1: you will see at this point I am able to receive the emails and with the commented code will see how I saved the file as a text file
Comment2: here you will see I played with some of the MIME functions but do not have any clue of the whole structure, how the functions work together. The un commented piece creates a file but does not put anything into the file
Comment3: I'm not deleting the email so I do not to have to send it the whole time
Please if you could point me in the right direction
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: downloading email saving as outlook compattible file WIN32
by roboticus (Chancellor) on May 29, 2006 at 13:37 UTC | |
|
Re: downloading email saving as outlook compattible file WIN32
by jdtoronto (Prior) on May 29, 2006 at 13:59 UTC | |
|
Re: downloading email saving as outlook compattible file WIN32
by roboticus (Chancellor) on May 31, 2006 at 16:17 UTC |