LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 07-02-2005, 08:37 AM   #1
nibbler
Member
 
Registered: Oct 2003
Location: Croatia
Distribution: Fedora 4
Posts: 46

Rep: Reputation: 15
perl script to report new mail


this is a perl script run by cynapses_karamba. It is supposed to get new mail count from gmail. The problem is that it always dies at "Couldn't log on to server". I've enabled POP3 on gmail. I haven't really programmed in perl, so it's hard for me to debug. Can someone tell what is wrong:
Code:
#!/usr/bin/perl
use Net::POP3;

my $ServerName = "pop.gmail.com";
# If your username contains a @ character you
# must replace it with \@
my $UserName = "myusrname\@gmail.com";
my $Password = "my_pass";
my $pop3 = Net::POP3->new($ServerName,Timeout => 5);
die "Couldn't log on to server" unless $pop3;

my $Num_Messages = $pop3->login($UserName, $Password) + 0;
if ( $Num_Messages == 1 ){
   print $Num_Messages ." new\n";
}
elsif ( $Num_Messages > 1 ){
    print $Num_Messages ." new\n";
}
else{
    print "0 new\n";
}

$pop3->quit();
For those of you who have cynapses_karamba, have you managed to enable network ingoing/outgoing graph? I haven't
 
Old 07-02-2005, 09:13 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
I think you need to use ssl with gmail. I'd either set up an stunnel wrapper for that script or us this cpan module instead of Net::POP3:
http://search.cpan.org/~sdowd/Mail-P.../POP3Client.pm
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl question: how to insert an e-mail address in a script Pastorino Programming 3 08-08-2005 08:28 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
howto send a mail with attachment via perl script ? cccc Programming 24 03-05-2004 07:49 PM
Mail script with Perl & Postfix Bladez Programming 2 02-14-2004 09:59 PM
I'm looking for a simply perl script to send mail, when ping down cccc Programming 2 01-12-2004 04:36 AM


All times are GMT -5. The time now is 05:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration