Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Accessing IMAP-Server Outlook.office365.com via Perl

by holli (Abbot)
on Sep 17, 2019 at 12:29 UTC ( [id://11106296]=note: print w/replies, xml ) Need Help??


in reply to Accessing IMAP-Server Outlook.office365.com via Perl

We can't really help you without seeing the actual code. My best guess without that: Your old script propably did not use encryption, but O365 only works with SSL/TLS encryption. Or maybe the port or the host adress are incorrect. For more information, see the google snippet for "office 365 imap settings".


holli

You can lead your users to water, but alas, you cannot drown them.

Replies are listed 'Best First'.
Re^2: Accessing IMAP-Server Outlook.office365.com via Perl
by PerlingAround (Novice) on Sep 17, 2019 at 13:48 UTC
    #!/usr/local/bin/perl -w use Net::IMAP::Simple; use Date::Parse; my $imap_server = '40.101.136.18'; printf $imap_server; printf "\n"; if (!($imap_con = new Net::IMAP::Simple($imap_server, find_ssl_default +s=>[]))) { print "The Server is not available. \n"; exit; } my $user = 'USER'; my $password = qq(PW); if (!($imap_con->login($user, $password))) { print "invalid Login: ". $imap_con->errstr ."\n"; exit; } $imap_con->quit(); print "login possible. \n"; exit;

    This is the small "Test"-Script I am using to see if I can login. It's basically c&p from how I invoked the methods in the previous script and "errstr" always returns "Command received in invalid state".

      I highly recommend you look at the module page on CPAN here and follow the example code more closely. You're ignoring the return status of your calls, and that's going to make it virtually impossible to understand what's failing.

      Alex / talexb / Toronto

      Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

      This seems to work, although I'd give the same warning about blindly accepting the SSL certificate as they do on https://metacpan.org/pod/distribution/Net-IMAP-Simple/lib/Net/IMAP/Simple.pm#new
      #!/usr/local/bin/perl -w use Net::IMAP::Simple; use Date::Parse; my $imap_server = '40.101.136.18'; printf $imap_server; printf "\n"; if (!($imap_con = new Net::IMAP::Simple($imap_server, port => 993, use +_ssl => 'true'))) { print "The Server is not available. $Net::IMAP::Simple::errstr +\n"; exit; } my $user = ''; my $password = ''; if (!($imap_con->login($user, $password))) { print "invalid Login: ". $imap_con->errstr ."\n"; exit; } $imap_con->quit(); print "login possible. \n"; exit;
      You might consider using Email::Folder::Exchange

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11106296]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found