Hi Experts.,

i written One email receiving code by using Perl Modules with CGI. here i have getting one error

"Failed to connect to pop3.gmail.com at mail.pl line 14, <STDIN> line 3."., but i am trying to connect my gmail account and yahoo too., Otherwise let me know which module is suitable to retrieve the mails., still i am getting same error.,

i hope any one can help to me. i belowed mention the code

Advance Thanks.,

Senthil. V

chennai

India

use warnings; use strict; use Net::POP3; my $subject_width = 50; my $from_width = 80; print "Mail Server: "; my $mailserver = <STDIN>; print "Username: "; my $username = <STDIN>; print "Password: "; my $password = <STDIN>; chomp ($mailserver, $username, $password); my $pop3 = Net::POP3->new($mailserver) or die "Failed to conn +ect to $mailserver"; my $tot_msg = $pop3->login($username,$password) or die "Failed to auth +enticate $username"; printf("\n There are $tot_msg messages\n\n"); foreach my $msg_id (1 .. $tot_msg) { my $header = $pop3 -> top($msg_id, 0); my ($subject, $from, $status) = analyze_header($header); my $delete = ""; if ($subject eq 'Document') { $delete = 'del'; $pop3->delete($msg_id); # not really deleted until quit is called } printf "[%3d] %-${subject_width}s %-${from_width}s %6s %3s\n", $msg_id, substr($subject,0,$subject_width), substr($from ,0,$from_width ), $status, $delete; } print "Quit and Delete?\n"; my $quit = <STDIN>; chomp $quit; if (lc $quit eq 'y' or lc $quit eq 'yes') { print "quitting and deleting\n"; $pop3 -> quit; # deleted messages are deleted now } sub analyze_header { my $header_array_ref = shift; my $header = join "", @$header_array_ref; my ($subject) = $header =~ /Subject: (.*)/m; my ($from ) = $header =~ /From: (.*)/m; my ($status ) = $header =~ /Status: (.*)/m; if (defined $status) { $status = "Unread" if $status eq 'O'; $status = "Read" if $status eq 'R'; $status = "Read" if $status eq 'RO'; $status = "Ne $status = "-";w" if $status eq 'NEW'; $status = "New" if $status eq 'U'; } else { $status = "-"; } return ($subject, $from, $status); }

In reply to I cant recieve the mails from Gmail or any other account by senthil_v

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.