[rt-devel] Mail via POP3 and hello

jon at hogue.org jon at hogue.org
Fri Feb 13 23:03:32 EST 2004


Hi, 
I'm jon. I'm new to rt... This may be duplicate work, but I couldn't find
documentation of such a thing any where. The following is a simple script to
pull mails from a pop3 server.

Also, I was wondering if there was any CPAN type documentation any where to
cover rt modules. I couldn't find any. It seems the only way to figure out how
to customize code is to look through the code and look over samples from other
people. Biggest problem I found with that is some of the sample code I've found
on various sites doesn't seem to work (due to backwords compatability issues??
or my ignorance of rt??).

rt is a cool piece of software, and I hope I can contribute!

#!/usr/bin/perl
use Net::POP3;
                                                                               
                                             
# Constructors
my $pop = Net::POP3->new('mail.myserver.com');
my $username = "rt";
my $password = "password";
                                                                               
                                             
if ($pop->login($username, $password) > 0) {
  my $msgnums = $pop->list; # hashref of msgnum => size
  foreach my $msgnum (keys %$msgnums) {
    my $msg = $pop->get($msgnum);
    open( RTGW, "|/opt/rt3/bin/rt-mailgate --queue general --action correspond
--url http://rt.hogue.org/");
    print RTGW @$msg;
    close RTGW;
    $pop->delete($msgnum);
 }
}
$pop->quit;



More information about the Rt-devel mailing list