when i run the script below am getting "LOGIN FAILURE: access denied", if I login with Net::IMAP::Simple and my username and password is correct. However, If I run same script on my local server, its working okay.

If I use the Mail::IMAPClient module to  do the login.

I have the error below.

Started at Mon Jun 30 14:05:44 2008
Using Mail::IMAPClient version 3.08 on perl 5.010000
Connecting to imap.mail.yahoo.com port 143
Connected to imap.mail.yahoo.com
Read: * OK IMAP4rev1 server ready (3.5.28)
Sending: 1 LOGIN "testkingonet" 123456
Sent 24 bytes
Read: 1 NO LOGIN failure. Access denied
ERROR: 1 NO LOGIN failure. Access denied
Can't call method "select" on an undefined value at mailfetcher-imapclien.pl line 32.


Can someone help out on this s that I can use that to access yahoo and hotmail, gmail etc etc with the script.

Goksie

#!/usr/bin/perl

#mailfetcher.pl

use warnings;
use strict;
use diagnostics;
use Net::IMAP::Simple;
use Email::Simple;
use Mail::IMAPClient;

my $imapserver = 'imap.mail.yahoo.com';
my $user = 'testkingonet';
my $pass = '123456';

my $imap = Net::IMAP::Simple->new("$imapserver") or die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr\n";

#If the module Mail::IMAPClient is used for login ###
#-------------------------------------------------###
#my $imap = Mail::IMAPClient->new;
#$imap = Mail::IMAPClient->new(
#                        Server => $imapserver,
#                        User    => $user,
#                        Password=> $pass,
# Clear => 5, # Unnecessary since '5' is the #default
#                        Authmechanism => "CRAM-MD5",
#        #               ...             # Other key=>value pairs go #here
#);
#if($imap->login){
#print "Success";
#} else {print "Could not login: [EMAIL PROTECTED]";}


    # Log on
   if(!$imap->login("$user","$pass")){
       print STDERR "Login failed: " . $imap->errstr . "\n";
       exit(64);
    }
    my $inbox =~ m/inbox/i;

    # Print the subject's of all the messages in the INBOX
    my $nem = $imap->select("$inbox");

      my $emailsimple = Email::Simple->new(join '', @{ $imap->get($nem) });
      print $emailsimple->body;


      $imap->quit;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to