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


In reply to downloading email saving as outlook compattible file WIN32 by PugSA

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.