PHP Classes

Qmail Problem solved

Recommend this page to a friend!  >  All threads  >  Qmail Problem solved  >  (Un) Subscribe thread alerts  
Subject:Qmail Problem solved
Summary:Qmail can make some problems with responses. Here the solution
Author:Daniel Sepeur
Date:2006-06-26 07:46:15

  1. Qmail Problem solved   Reply   Report abuse  
Picture of Daniel Sepeur Daniel Sepeur - 2006-06-26 07:46:16

I am dealing with this classe and during my work i found out, that the communication with qmail is a little bit different from other servers.

At the function get_mail on line 468 in, the response should be like "+OK".

if(substr($response,0,3) != "+OK")

But qmail sends a dot (.) instead of this.
Therefore i changed the function like this:

On line 448 change function get_mail( $msg_number ) to function get_mail($msg_number,$qmailer)

After them, between line 468 and 472 replace the following code

if(substr($response,0,3) != "+OK")
$this->error = "POP3 get_mail() - Error: ".$response;
return FALSE;


// Qmail sendet einen Punkt (.) anstelle von +OK. Das fangen wir ab.
// In der Konfiguration geben wir $qmailer = 0 oder $qmailer = 1 an
if ($qmailer == "1") {
if(substr($response,0,1) != '.') {
$this->error = "POP3 get_mail() - Error: ".$response;
return FALSE;
else {
if(substr($response,0,3) != "+OK") {
$this->error = "POP3 get_mail() - Error: ".$response;
return FALSE;

Now go to the file pop3_test.php.
On line 17 or 18 you can set the config-variable:
$qmailer = 1; // Wether the target server is qmail or not

Now go to line 112 and change

if(!$message = $pop3->get_mail($i)){


if(!$message = $pop3->get_mail($i,$qmailer)){

After you have done this steps, you are ready to fetch POP3 mails with Qmail.