user_78361084
user_78361084

Reputation: 3928

how do I check email?

I know how to send email...how do I download my email? I've been searching on cpan & google & came across Mail::POP3Client...which I couldn't get to work. I have a gmail account but want to be able to check other accounts as well (which may or may not be pop).

#!/usr/bin/perl
use strict;
use warnings;
use Mail::POP3Client;

 use Mail::POP3Client;

 my $pop = new Mail::POP3Client( USER     => "user",
                               PASSWORD => "pass",
                               HOST     => "pop.gmail.com" );

 for (my $i = 1; $i <= $pop->Count(); $i++) {
    foreach ( $pop->Head( $i ) ) {
      /^(From|Subject):\s+/i and print $_, "\n";
    }
    print "\n";
  }

Upvotes: 0

Views: 891

Answers (1)

Francisco R
Francisco R

Reputation: 4048

To check Gmail you need to use SSL:

my $pop = new Mail::POP3Client( USER     => "user",
                               PASSWORD => "pass",
                               HOST     => "pop.gmail.com",
                               USESSL   => true );

Note: You need to enable POP in your Gmail acocunt. You can do it following this steps:

http://mail.google.com/support/bin/answer.py?answer=13273

Upvotes: 3

Related Questions