POP3 Authentication

POP3 Authentication

by Rudy Scott -
Number of replies: 6

I spent some time trying to get POP3 authentication to work with no luck.  Finally I made the following change to the open call in auth/pop3/lib.php:

$connection = imap_open($host, $username, $password, OP_HALFOPEN);

was replaced with:

$connection = imap_open($host, $username, $password);

This change seemed to solve all my problems.  According to the PHP documentation OP_HALFOPEN is for IMAP and NNTP servers.  There is no mention of POP3.  And it appeared on my system at least (and with several different servers) that including the OP_HALFOPEN parameter in this function call caused it to always fail when connecting to POP3 servers.  The purpose of the parameter is to make it connect to a mail account only rather than connecting and opening a mailbox.   Has anyone else had any luck with using POP3 authentication with the existing code?

While I was in there, I added a parameter for configuring the mailbox to connect to (since removing the OP_HALFOPEN makes it require one) rather than hardcoding INBOX.  I also modified a few of the strings that I found confusing.  My modified files are attatched here.  File locations are as follows:

/auth/pop3/lib.php
/auth/pop3/config.html
/lang/en/auth.php

Average of ratings: Useful (1)
In reply to Rudy Scott

Re: POP3 Authentication

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Thanks, Rudy! Somehow I missed this very helpful post before. I'll check it in right now.
In reply to Martin Dougiamas

Re: POP3 Authentication

by Zbigniew Fiedorowicz -

Hi Martin,

Note that in my case, I also needed to add the /username=$username parameter to the $host variable.

Zig

In reply to Rudy Scott

Re: POP3 Authentication

by gem gem -
I meet the same problem to use authentification with a Lotus Notes POP3 server.
It's resolve with this correction.

Phil.

In reply to Rudy Scott

Re: POP3 Authentication

by Luis Botelho -

Hi!

I tried to use your files, but it didn't work again...

I use Exchange 5.5... and when I enter with the username and password, and click in the button to access, my page becomes in blank - nothing happens.

I updated Moodle today, but the problem persist.

Do you know something about it?

Thanks!

In reply to Luis Botelho

Re: POP3 Authentication

by Philip Norton -

This happened to me. Check that your IMAP extensions are enabled in PHP -- look in the php.ini file in the extensions section. Even though you are using POP3, the IMAP library is needed.

Hope this helps!

Philip

In reply to Philip Norton

Re: POP3 Authentication

by Miki Lewinger -
Hey Phillip, your advice was great. Who could guess that Mandrake's standard installation would leave several extensions out of the vanilla php ? After I added the php-imap extension (BLESS URPMI FOR THAT !!!), authentication worked fine.

Miki Lewinger
Ben-Gurion University