elbow has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that reads emails from mailbox a into text files on a seperate directory, then connects to mailbox b and writes the 'text file' emails to the mailbox. It uses POP3 to retrieve the emails and SMTP to send them. Both mailbox's are held on the same server/IP address.

My question is -> is there anyway I can transfer the emails from one mailbox to another without using the above process? I've had a look on CPAN but can't find anything (which doesn't mean there isn't anything there - I'm probably searching wrong!). I've not used POP3 before so am learning as I go, but can't find anything in the documentation that looks like it will do what I want.

I'm on win32 using Perl 5.6

elbow

Replies are listed 'Best First'.
Re: POP3 and email transfers
by Roger (Parson) on Feb 02, 2004 at 13:03 UTC
    I've had a look on CPAN but can't find anything...

    Have a look at the Mail::Box package, it has what you need and more, and it is fairly easy to use as well.

      Thanks Roger - that looks to be what I'm after

      elbow
Re: POP3 and email transfers
by Abigail-II (Bishop) on Feb 02, 2004 at 12:41 UTC
    You mean, a program that uses a mail retrieval protocol on one end, and a mail delivery protocol at the other end? There are such programs, fetchmail for instance, but what does that have to do with Perl?

    Abigail

Re: POP3 and email transfers
by ysth (Canon) on Feb 02, 2004 at 17:01 UTC
    I didn't think POP3 supported copying from one mailbox to another. Your will probably want to use IMAP instead, and I don't know if even that will allow you to copy from one user to another. Take a look at any of the Net::IMAP* modules.
Re: POP3 and email transfers
by gellyfish (Monsignor) on Feb 02, 2004 at 12:59 UTC

    If the mailboxes are on the same machine is there any reason why you can't simply concatenate the mailbox files without troubling any network servers. You should probably take out a lock on both files while you are doing it, but aprt from that there should eb no problem.

    /J\

      If the mailboxes are on the same machine is there any reason why you can't simply concatenate the mailbox files without troubling any network servers.
      MTUs go to great lengths to ensure integrity of mail, minimizing the risk mail gets lost, or mailboxes corrupted. You may not want to just "concatenate files". What if a disk or system fails halfway your concatenation? Is it an acceptable risk that you don't know what you copied succesfully, when the system beneath you fails?

      Abigail