Page 1 of 1

Free Perl Pop3 Collector

Posted: 2006-12-18 15:41
by mthosting

Code: Select all

#MT Hosting
#Usage: Run this as a scheduled task to collect external pop3 email and move them into exchange.
use Net::POP3;
use Net::SMTP;

#1 = turn debug on || 0 = turn debug off
#to check for errors run the this from the command line. Example:
# perl 1>>expop.log 2>>expop.log

$inserver=""; #email server to get email from

$outserver="localhost"; #Exchange Server, this is usually localhost.

#Accounts to Collect e-mail from, Example:
# 'Pop3 user name' => {'password' =>  'Pop3 Password','sendto' =>  'Exchange E-mail Address',},
%accounts = (
            '' => {'password' =>  'pop3_pass','sendto' =>  'demo@demo_exchange.local',},

foreach $accnt (keys %accounts)
#print "User: $accnt password:", $accounts{$accnt} -> {"password"}, " sendto: ",$accounts{$accnt} -> {"sendto"}," \n";

   $pop = Net::POP3->new($inserver,Timeout => 60, Debug => $debug);
    if ($pop->login($accnt, $accounts{$accnt} -> {"password"}) > 0)
        my $msgnums = $pop->list;
        foreach my $msgnum (keys %$msgnums)
            my $msg = $pop->get($msgnum);
            $smtp = Net::SMTP->new($outserver, Timeout => 60, Debug =>$debug);
            $smtp->to($accounts{$accnt} -> {"sendto"});
print "done!";

1. Set $inserver to your incoming mail server to collect the pop3 email from. If you need to collect from multiple pop3 servers just copy the script and run them separately.
2. Set $outserver to the server that you would like to move the email to. It does not have to be a local server.
3. Set the %accounts array with the pop3 account you would like to collect.
If you are collect multiple pop3 accounts %accounts might look like this.

Code: Select all

%accounts = (
            '' => {'password' =>  'pop3_pass','sendto' =>  'demo@demo_exchange.local',},
             '' => {'password' =>  'demo2_pass','sendto' =>  'demo2@demo_exchange.local',},

Posted: 2007-06-25 01:31
by TheSeparator
Using this great script, all my incoming message are classified by ASSP as originating from a local domain..... and thus not verified/marked.

How can I avoid this ?


Posted: 2007-07-05 21:42
by mthosting
You can't, as far as the receiver is concerned the mail comes from the local host.


Re: Free Perl Pop3 Collector

Posted: 2008-06-26 20:32
by c0d3r
check out this nice, rich-featured free pop3 collector : ... 3collector

Re: Free Perl Pop3 Collector

Posted: 2008-07-05 11:38
by ewieldra

really nice connector