[add-on] POP3 without IMAP extension

3rd party code for phpList

[add-on] POP3 without IMAP extension

Postby ping » 4:29pm, Fri 17 Jun, 2005

For everyone not having the php-imap extension installed:

Installation:

- Make sure you have the Net_POP3 Pear module installed or do so by typing pear install Net_POP3. (or get it manually from pear.php.net)
- Replace your processbounces.php with the code below.
- Add define("USE_PEAR", 1); to your config.php
- Done.

Please let me know about any issues, I did not test it very well.
stefan at bitwise.ch

Code: Select all
<php>get("This page can only be called from the commandline");
    return;
  }
} else {
  ob_end_clean();
  print ClineSignature();
  ob_start();
}
print '<script></script>';
flush();
$outputdone =0;
function prepareOutput() {
  global $outputdone;
  if (!$outputdone) {
    $outputdone = 1;
    return formStart('name="outputform"').'<textarea></textarea></form>';
  }
}

$report = "";
## some general functions
function finish ($flag,$message) {
  if ($flag == "error") {
    $subject = $GLOBALS['I18N']->get("Bounce processing error");
  } elseif ($flag == "info") {
    $subject = $GLOBALS['I18N']->get("Bounce Processing info");
  }
  if (!TEST && $message)
    sendReport($subject,$message);
}

function ProcessError ($message) {
  output( "$message");
  finish('error',$message);
  exit;
}

function my_shutdown() {
  global $report,$process_id;
  releaseLock($process_id);
 # $report .= "Connection status:".connection_status();
  finish('info',$report);
}

function output ($message,$reset = 0) {
  $infostring = "[". date("D j M Y H:i",time()) . "] [" . getenv("REMOTE_HOST") ."] [" . getenv("REMOTE_ADDR") ."]";
  #print "$infostring $message<br>\n";
  if ($GLOBALS["commandline"]) {
    ob_end_clean();
    print strip_tags($message) . "\n";
    ob_start();
  } else {
    if ($reset)
      print '<script>
        if (document.forms[0].name == "outputform") {
          document.outputform.output.value = "";
          document.outputform.output.value += "\n";
        }
      </script>'."\n";
    print '<script>
      if (document.forms[0].name == "outputform") {
        document.outputform.output.value += "'.$message.'";
        document.outputform.output.value += "\n";
      } else
        document.writeln("'.$message.'");
    </script>'."\n";
  }

  flush();
}

function processBounce ($link,$num,$header) {
 
  global $tables;
  if(USE_PEAR){
    $headerinfo = $link->getParsedHeaders($num);
   $msg_date = $headerinfo['Date'];
   $body = $link->getBody($num);
  }else{
    $headerinfo = imap_headerinfo($link,$num);
   $msg_date = $headerinfo->Date;
   $body= imap_body ($link,$num);
  }
 

 
  $msgid = 0;$user = 0;
 
  preg_match ("/X-MessageId: (.*)/i",$body,$match);
  if (is_array($match) && isset($match[1]))
    $msgid= trim($match[1]);
  if (!$msgid) {
    # older versions use X-Message
    preg_match ("/X-Message: (.*)/i",$body,$match);
    if (is_array($match) && isset($match[1]))
      $msgid= trim($match[1]);
  }

  preg_match ("/X-ListMember: (.*)/i",$body,$match);
  if (is_array($match) && isset($match[1]))
    $user = trim($match[1]);
  if (!$user) {
    # older version use X-User
    preg_match ("/X-User: (.*)/i",$body,$match);
    if (is_array($match) && isset($match[1]))
      $user = trim($match[1]);
  }

  # some versions used the email to identify the users, some the userid and others the uniqid
  # use backward compatible way to find user
  if (preg_match ("/.*@.*/i",$user,$match)) {
    $userid_req = Sql_Fetch_Row_Query("select id from {$tables["user"]} where email = \"$user\"");
    if (VERBOSE)
      output("UID".$userid_req[0]." MSGID".$msgid);
    $userid = $userid_req[0];
  } elseif (preg_match("/^\d$/",$user)) {
    $userid = $user;
    if (VERBOSE)
      output( "UID".$userid." MSGID".$msgid);
  } elseif ($user) {
    $userid_req = Sql_Fetch_Row_Query("select id from {$tables["user"]} where uniqid = \"$user\"");
    if (VERBOSE)
      output( "UID".$userid_req[0]." MSGID".$msgid);
    $userid = $userid_req[0];
  } else {
    $userid = '';
  }
  Sql_Query(sprintf('insert into %s (date,header,data)
    values("%s","%s","%s")',
    $tables["bounce"],
    date("Y-m-d H:i",strtotime($msg_date)),
    addslashes($header),
    addslashes($body)));

//nizar 'set status', 'comment' etc.?? +50 lignes ci-dessous
  $bounceid = Sql_Insert_id();
  if ($msgid == "systemmessage" && $userid) {
    Sql_Query(sprintf('update %s
      set status = "bounced system message",
      comment = "%s marked unconfirmed"
      where id = %d',
      $tables["bounce"],
      $userid,$bounceid));
     logEvent("$userid ".$GLOBALS['I18N']->get("system message bounced, user marked unconfirmed"));
    addUserHistory($user,$GLOBALS['I18N']->get("Bounced system message"),"
    <br>".$GLOBALS['I18N']->get("User marked unconfirmed")."
    <br><a>".$GLOBALS['I18N']->get("View Bounce")."</a>

    ");
    Sql_Query(sprintf('update %s
      set confirmed = 0
      where id = %d',
      $tables["user"],
      $userid));
  } elseif ($msgid && $userid) {
    Sql_Query(sprintf('update %s
      set status = "bounced list message %d",
      comment = "%s bouncecount increased"
      where id = %d',
      $tables["bounce"],
      $msgid,
      $userid,$bounceid));
    Sql_Query(sprintf('update %s
      set bouncecount = bouncecount + 1
      where id = %d',
      $tables["message"],
      $msgid));
    Sql_Query(sprintf('update %s
      set bouncecount = bouncecount + 1
      where id = %d',
      $tables["user"],
      $userid));
    Sql_Query(sprintf('insert into %s
      set user = %d, message = %d, bounce = %d',
      $tables["user_message_bounce"],
      $userid,$msgid,$bounceid));
  } elseif ($userid) {
    Sql_Query(sprintf('update %s
      set status = "bounced unidentified message",
      comment = "%s bouncecount increased"
      where id = %d',
      $tables["bounce"],
      $userid,$bounceid));
    Sql_Query(sprintf('update %s
      set bouncecount = bouncecount + 1
      where id = %d',
      $tables["user"],
      $userid));
  } else {
    Sql_Query(sprintf('update %s
      set status = "unidentified bounce",
      comment = "not processed"
      where id = %d',
      $tables["bounce"],
      $bounceid));
     return false;
  }
  return true;
}

function processPop ($server,$user,$password) {
  $port =  $GLOBALS["bounce_mailbox_port"];
  if (!$port) {
    $port = '110/pop3/notls';
  }
  set_time_limit(6000);
 
  if(USE_PEAR){

    // Setup pear Net_POP3 connection
    $link =& new Net_POP3();
   //$link->setDebug();
   if(PEAR::isError( $ret= $link->connect($server , $port ) )){
     
     Error($GLOBALS['I18N']->get("Cannot create POP3 connection to")." $server:$port ".$ret->getMessage());
      return;
    }
   if(PEAR::isError( $ret= $link->login($user,$password,'USER' ) )){
   
      Error($GLOBALS['I18N']->get("Wrong username or password($user,$password) for ")." $server:$port ".$ret->getMessage());
      return;
    }
  } else {
    if (!TEST) {
      $link=imap_open("{".$server.":".$port."}INBOX",$user,$password,CL_EXPUNGE);
    } else {
      $link=imap_open("{".$server.":".$port."}INBOX",$user,$password);
   
    }
    if (!$link) {
      Error($GLOBALS['I18N']->get("Cannot create POP3 connection to")." $server: ".imap_last_error());
      return;
    }
  }
 

  return processMessages($link,100000);
}

function processMbox ($file) {
  set_time_limit(6000);

  if (!TEST) {
    $link=imap_open($file,"","",CL_EXPUNGE);
  } else {
    $link=imap_open($file,"","");
  }
  if (!$link) {
    Error($GLOBALS['I18N']->get("Cannot open mailbox file")." ".imap_last_error());
    return;
  }
 
  return processMessages($link,100000);
}

function processMessages($link,$max = 3000) {
  #error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
  global $bounce_mailbox_purge_unprocessed,$bounce_mailbox_purge;
  if(USE_PEAR){
    $num = $link->numMsg();
   
  }else{
    $num = imap_num_msg($link);
  }
  print $num . " ".$GLOBALS['I18N']->get("bounces to fetch from the mailbox")."<br>\n";
  print $GLOBALS['I18N']->get("Please do not interrupt this process")."<br>";
  $report = $num . " ".$GLOBALS['I18N']->get("bounces to process")."\n";
  if ($num > $max) {
    print $GLOBALS['I18N']->get("Processing first")." $max ".$GLOBALS['I18N']->get("bounces")."<br>";
    $report .= $num . " ".$GLOBALS['I18N']->get("processing first")." $max ".$GLOBALS['I18N']->get("bounces")."\n";
    $num = $max;
  }
  if (TEST) {
    print $GLOBALS['I18N']->get("Running in test mode, not deleting messages from mailbox")."<br>";
  } else {
    print $GLOBALS['I18N']->get("Processed messages will be deleted from mailbox")."<br>";
  }
  print prepareOutput();
  print '<script> yposition = 10;document.write(progressmeter); start();</script>';
  flush();
  $nberror = 0;
#  for ($x=1;$x<150;$x++) {
  for($x=1; $x <num>getRawHeaders($x);
    }else{
      $header = imap_fetchheader($link,$x);
   }
    if ($x % 25 == 0)
  #    output( $x . " ". nl2br($header));
      output($x . " done",1);
    print "\n";
    flush();
    $processed = processBounce($link,$x,$header);
    if ($processed) {
      if (!TEST && $bounce_mailbox_purge) {
        if (VERBOSE)
        output( $GLOBALS['I18N']->get("Deleting message")." $x");
      if(USE_PEAR){
          $link->deleteMsg($x);
        }else{
          imap_delete($link,$x);
      }
       }
    } else {
      if (!TEST && $bounce_mailbox_purge_unprocessed) {
        if (VERBOSE)
          output( $GLOBALS['I18N']->get("Deleting message")." $x");
          if(USE_PEAR){
            $link->deleteMsg($x);
          }else{
            imap_delete($link,$x);
        }
       }
    }
    flush();
  }
  flush();
  output($GLOBALS['I18N']->get("Closing mailbox, and purging messages"));
  set_time_limit(60 * $num);
  if(USE_PEAR){
    $link->disconnect();
  }else{ 
    imap_close($link);
  }
  print '<script> finish(); </script>';
  if ($num)
    return $report;
}

if (!function_exists("imap_open") && !USE_PEAR) {
  Error($GLOBALS['I18N']->get("IMAP is not included in your PHP installation, cannot continue")."<br>".$GLOBALS['I18N']->get("Check out").' <a>http://www.php.net/manual/en/ref.imap.php</a>');
  return;
}

if (!$bounce_mailbox && (!$bounce_mailbox_host || !$bounce_mailbox_user || !$bounce_mailbox_password)) {
  Error($GLOBALS['I18N']->get("Bounce mechanism not properly configured"));
  return;
}

# lets not do this unless we do some locking first
$abort = ignore_user_abort(1);
register_shutdown_function("my_shutdown");
$process_id = getPageLock();

switch ($bounce_protocol) {
  case "pop":
    //echo "Starting pop";
    $download_report =  processPop ($bounce_mailbox_host,$bounce_mailbox_user,$bounce_mailbox_password);
    break;
  case "mbox":
    $download_report = processMbox($bounce_mailbox);
    break;
  default:
    Error($GLOBALS['I18N']->get("bounce_protocol not supported"));
    return;
}

# now we have filled database with all available bounces
# have a look who should be flagged as unconfirmed
print '<script> yposition = 10;document.write(progressmeter); start();</script>';
print prepareOutput();

output($GLOBALS['I18N']->get("Identifying consecutive bounces"));

# we only need users who are confirmed at the moment
$userid_req = Sql_Query(sprintf('select distinct %s.user from %s,%s
  where %s.id = %s.user and %s.confirmed',
  $tables["user_message_bounce"],
  $tables["user_message_bounce"],
  $tables["user"],
  $tables["user"],
  $tables["user_message_bounce"],
  $tables["user"]
));
$total = Sql_Affected_Rows();
if (!$total)
  output($GLOBALS['I18N']->get("Nothing to do"));

$usercnt = 0;
$unsubscribed_users = "";
while ($user = Sql_Fetch_Row($userid_req)) {
  # give messages five days to bounce, most MTAs keep them in the queue for 4 days
  # before giving up.
  keepLock($process_id);
  set_time_limit(600);
  $msg_req = Sql_Query(sprintf('select * from
    %s left join %s on %s.messageid = %s.message
    where (date_add(entered,INTERVAL 5 day) <now> %d bounces',$user[0],$cnt));
        $userurl = PageLink2("user&id=$user[0]",$user[0]);
        logEvent($GLOBALS['I18N']->get("User")." $userurl ".$GLOBALS['I18N']->get("has consecutive bounces")." ($cnt) ".$GLOBALS['I18N']->get("over treshold, user marked unconfirmed"));
        $emailreq = Sql_Fetch_Row_Query("select email from {$tables["user"]} where id = $user[0]");
        addUserHistory($emailreq[0],$GLOBALS['I18N']->get("Auto Unsubscribed"),$GLOBALS['I18N']->get("User auto unsubscribed for")." $cnt ".$GLOBALS['I18N']->get("consecutive bounces"));
        Sql_Query(sprintf('update %s set confirmed = 0 where id = %d',$tables["user"],$user[0]));
        $email_req = Sql_Fetch_Row_Query(sprintf('select email from %s where id = %d',$tables["user"],$user[0]));
        $unsubscribed_users .= $email_req[0] . " [$user[0]] ($cnt)\n";
      }
    } elseif ($bounce["bounce"] == "") {
      $cnt = 0;
    }
  }
  if ($usercnt % 10 == 0) {
    output($GLOBALS['I18N']->get("Identifying consecutive bounces"));
    output("$usercnt ".$GLOBALS['I18N']->get("of")." $total ".$GLOBALS['I18N']->get("users processed"),1);
  }
  $usercnt++;
  flush();
}
output($GLOBALS['I18N']->get("Identifying consecutive bounces"));
output("$total ".$GLOBALS['I18N']->get("users processed"),1);

if ($download_report) {
  $report = $GLOBALS['I18N']->get("Report:")."\n$download_report\n";
}

if ($unsubscribed_users) {
  $report .= "\n".$GLOBALS['I18N']->get("Below are users who have been marked unconfirmed. The number in [] is their userid, the number in () is the number of consecutive bounces")."\n";
  $report .= "\n$unsubscribed_users";
}
print '<script> finish(); </script>';
# shutdown will take care of reporting
#finish("info",$report);

?>




    [list=][/list]
    Code: Select all
    ping
    phpList newbie
     
    Posts: 4
    Joined: 9:09am, Fri 17 Jun, 2005

    i tested it but...

    Postby phplist2005 » 12:43pm, Fri 26 Aug, 2005

    Hi

    I tested your contribution with Net/POP3 pear
    i logges very well to my pop3 account
    and after nothing the email don't appear on the bounce list.

    Any idea ??
    phplist2005
    phpList newbie
     
    Posts: 1
    Joined: 12:40pm, Fri 26 Aug, 2005

    Postby SamIAM » 3:23am, Fri 07 Oct, 2005

    i tried that, its not working :(

    how do i know i have that module installed ?
    SamIAM
    PL Nut
     
    Posts: 22
    Joined: 5:30pm, Fri 23 Sep, 2005
    Location: Michigan

    Postby SamIAM » 7:14pm, Fri 07 Oct, 2005

    it fails at this line:


    $link =& new Net_POP3();



    anyone ?
    SamIAM
    PL Nut
     
    Posts: 22
    Joined: 5:30pm, Fri 23 Sep, 2005
    Location: Michigan

    I got it to work

    Postby afeuer » 12:57am, Thu 22 Dec, 2005

    I made the following modification and it work:

    Under admin i onebed a file pop3.php that includes
    Code: Select all
    <?php
    // +-----------------------------------------------------------------------+
    // | Author: Richard Heyes <richard@phpguru.org>                           |
    // | Co-Author: Damian Fernandez Sosa <damlists@cnba.uba.ar>               |
    // +-----------------------------------------------------------------------+
    //
    // $Id: POP3.php,v 1.2 2004/12/05 16:34:39 damian Exp $

    require_once('Net/Socket.php');



    /**
    *  +----------------------------- IMPORTANT ------------------------------+
    *  | Usage of this class compared to native php extensions such as IMAP   |
    *  | is slow and may be feature deficient. If available you are STRONGLY  |
    *  | recommended to use the php extensions.                               |
    *  +----------------------------------------------------------------------+
    *
    * POP3 Access Class
    *
    * For usage see the example script
    */

    define('NET_POP3_STATE_DISCONNECTED',  1, true);
    define('NET_POP3_STATE_AUTHORISATION', 2, true);
    define('NET_POP3_STATE_TRANSACTION',   4, true);

    class Net_POP3 {

        /*
        * Some basic information about the mail drop
        * garnered from the STAT command
        *
        * @var array
        */
        var $_maildrop;

        /*
        * Used for APOP to store the timestamp
        *
        * @var string
        */
        var $_timestamp;

        /*
        * Timeout that is passed to the socket object
        *
        * @var integer
        */
        var $_timeout;

        /*
        * Socket object
        *
        * @var object
        */
        var $_socket;

        /*
        * Current state of the connection. Used with the
        * constants defined above.
        *
        * @var integer
        */
        var $_state;

        /*
        * Hostname to connect to
        *
        * @var string
        */
        var $_host;

        /*
        * Port to connect to
        *
        * @var integer
        */
        var $_port;

        /**
        * To allow class debuging
        * @var boolean
        */
        var $_debug = false;


        /**
        * The auth methods this class support
        * @var array
        */
        //var $supportedAuthMethods=array('DIGEST-MD5', 'CRAM-MD5', 'APOP' , 'PLAIN' , 'LOGIN', 'USER');
        //Disabling DIGEST-MD5 for now
        var $supportedAuthMethods=array( 'CRAM-MD5', 'APOP' , 'PLAIN' , 'LOGIN', 'USER');
        //var $supportedAuthMethods=array( 'CRAM-MD5', 'PLAIN' , 'LOGIN');
        //var $supportedAuthMethods=array( 'PLAIN' , 'LOGIN');


        /**
        * The auth methods this class support
        * @var array
        */
        var $supportedSASLAuthMethods=array('DIGEST-MD5', 'CRAM-MD5');


        /**
        * The capability response
        * @var array
        */
        var $_capability;

       /*
        * Constructor. Sets up the object variables, and instantiates
        * the socket object.
        *
        */


        function Net_POP3()
        {
            $this->_timestamp =  ''; // Used for APOP
            $this->_maildrop  =  array();
            $this->_timeout   =  3;
            $this->_state     =  NET_POP3_STATE_DISCONNECTED;
            $this->_socket    =& new Net_Socket();
            /*
            * Include the Auth_SASL package.  If the package is not available,
            * we disable the authentication methods that depend upon it.
            */
            if ((@include_once 'Auth/SASL.php') == false) {
                if($this->_debug){
                    echo "AUTH_SASL NOT PRESENT!\n";
                }
                foreach($this->supportedSASLAuthMethods as $SASLMethod){
                    $pos = array_search( $SASLMethod, $this->supportedAuthMethods );
                    if($this->_debug){
                        echo "DISABLING METHOD $SASLMethod\n";
                    }
                    unset($this->supportedAuthMethods[$pos]);
                }
            }



        }


        /**
        * Handles the errors the class can find
        * on the server
        *
        * @access private
        * @return PEAR_Error
        */

        function _raiseError($msg, $code =-1)
        {
        include_once 'PEAR.php';
        return PEAR::raiseError($msg, $code);
        }


       
        /*
        * Connects to the given host on the given port.
        * Also looks for the timestamp in the greeting
        * needed for APOP authentication
        *
        * @param  string $host Hostname/IP address to connect to
        * @param  string $port Port to use to connect to on host
        * @return bool  Success/Failure
        */
        function connect($host = 'localhost', $port = 110)
        {
            $this->_host = $host;
            $this->_port = $port;

            $result = $this->_socket->connect($host, $port, false, $this->_timeout);
            if ($result === true) {
                $data = $this->_recvLn();

                if( $this->_checkResponse($data) ){
                // if the response begins with '+OK' ...
    //            if (@substr(strtoupper($data), 0, 3) == '+OK') {
                    // Check for string matching apop timestamp
                    if (preg_match('/<.+@.+>/U', $data, $matches)) {
                        $this->_timestamp = $matches[0];
                    }
                    $this->_maildrop = array();
                    $this->_state    = NET_POP3_STATE_AUTHORISATION;

                    return true;
                }
            }

            $this->_socket->disconnect();
            return false;
        }

        /*
        * Disconnect function. Sends the QUIT command
        * and closes the socket.
        *
        * @return bool Success/Failure
        */
        function disconnect()
        {
            return $this->_cmdQuit();
        }

        /*
        * Performs the login procedure. If there is a timestamp
        * stored, APOP will be tried first, then basic USER/PASS.
        *
        * @param  string $user Username to use
        * @param  string $pass Password to use
        * @param  mixed $apop Whether to try APOP first, if used as string you can select the auth methd to use ( $pop3->login('validlogin', 'validpass', "CRAM-MD5");
        *          Valid methods are: 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'
        * @return mixed  true on Success/ PEAR_ERROR on error
        */
        function login($user, $pass, $apop = true)
        {
            if ($this->_state == NET_POP3_STATE_AUTHORISATION) {

                if(PEAR::isError($ret= $this->_cmdAuthenticate($user , $pass , $apop ) ) ){
                    return $ret;
                }
                if( ! PEAR::isError($ret)){
                    $this->_state = NET_POP3_STATE_TRANSACTION;
                    return true;
                }

            }
            return $this->_raiseError('Generic login error' , 1);
        }



        /**
        * Parses the response from the capability command. Stores
        * the result in $this->_capability
        *
        * @access private
        */
        function _parseCapability()
        {

            if(!PEAR::isError($data = $this->_sendCmd('CAPA'))){
                $data = $this->_getMultiline();
            }else {
                // CAPA command not supported, reset data var
                //  to avoid Notice errors of preg_split on an object
                $data = '';
            }
            $data = preg_split('/\r?\n/', $data, -1, PREG_SPLIT_NO_EMPTY);

            for ($i = 0; $i < count($data); $i++) {

                $capa='';
                if (preg_match('/^([a-z,\-]+)( ((.*))|$)$/i', $data[$i], $matches)) {

                    $capa=strtolower($matches[1]);
                    switch ($capa) {
                        case 'implementation':
                            $this->_capability['implementation'] = $matches[3];
                            break;
                        case 'sasl':
                            $this->_capability['sasl'] = preg_split('/\s+/', $matches[3]);
                            break;
                        default :
                            $this->_capability[$capa] = $matches[2];
                            break;
                    }
                }
            }
        }




        /**
         * Returns the name of the best authentication method that the server
         * has advertised.
         *
         * @param string if !=null,authenticate with this method ($userMethod).
         *
         * @return mixed    Returns a string containing the name of the best
         *                  supported authentication method or a PEAR_Error object
         *                  if a failure condition is encountered.
         * @access private
         * @since  1.0
         */
        function _getBestAuthMethod($userMethod = null)
        {

    /*
           return 'USER';
           return 'APOP';
           return 'DIGEST-MD5';
           return 'CRAM-MD5';
    */


            $this->_parseCapability();

            //unset($this->_capability['sasl']);

           if( isset($this->_capability['sasl']) ){
               $serverMethods=$this->_capability['sasl'];
           }else{
                $serverMethods=array('USER');
                // Check for timestamp before attempting APOP
                if ($this->_timestamp != null)
                {
                    $serverMethods[] = 'APOP';
                }
           }

            if($userMethod !== null && $userMethod !== true ){
                $methods = array();
                $methods[] = $userMethod;
                return $userMethod;
            }else{
                $methods = $this->supportedAuthMethods;
            }

            if( ($methods != null) && ($serverMethods != null)){

                foreach ( $methods as $method ) {

                    if ( in_array( $method , $serverMethods ) ) {
                        return $method;
                    }
                }
                $serverMethods=implode(',' , $serverMethods );
                $myMethods=implode(',' ,$this->supportedAuthMethods);
                return $this->_raiseError("$method NOT supported authentication method!. This server " .
                    "supports these methods: $serverMethods, but I support $myMethods");
            }else{
                return $this->_raiseError("This server don't support any Auth methods");
            }
        }






        /* Handles the authentication using any known method
         *
         * @param string The userid to authenticate as.
         * @param string The password to authenticate with.
         * @param string The method to use ( if $usermethod == '' then the class chooses the best method (the stronger is the best ) )
         *
         * @return mixed  string or PEAR_Error
         *
         * @access private
         * @since  1.0
         */
        function _cmdAuthenticate($uid , $pwd , $userMethod = null )
        {


            if ( PEAR::isError( $method = $this->_getBestAuthMethod($userMethod) ) ) {
                return $method;
            }

            switch ($method) {
                case 'DIGEST-MD5':
                    $result = $this->_authDigest_MD5( $uid , $pwd );
                    break;
                case 'CRAM-MD5':
                    $result = $this->_authCRAM_MD5( $uid , $pwd );
                    break;
                case 'LOGIN':
                    $result = $this->_authLOGIN( $uid , $pwd );
                    break;
                case 'PLAIN':
                    $result = $this->_authPLAIN( $uid , $pwd );
                    break;
                case 'APOP':
                    $result = $this->_cmdApop( $uid , $pwd );
                    // if APOP fails fallback to USER auth
                    if( PEAR::isError( $result ) ){
                        //echo "APOP FAILED!!!\n";
                        $result=$this->_authUSER( $uid , $pwd );
                    }
                    break;
                case 'USER':
                    $result = $this->_authUSER( $uid , $pwd );
                break;


                default :
                    $result = $this->_raiseError( "$method is not a supported authentication method" );
                    break;
            }
            return $result;
        }




         /* Authenticates the user using the USER-PASS method.
         *
         * @param string The userid to authenticate as.
         * @param string The password to authenticate with.
         *
         * @return mixed    true on success or PEAR_Error on failure
         *
         * @access private
         * @since  1.0
         */
        function _authUSER($user, $pass  )
        {
            if ( PEAR::isError($ret=$this->_cmdUser($user) ) ){
                return $ret;
            }
            if ( PEAR::isError($ret=$this->_cmdPass($pass) ) ){
                return $ret;
            }
            return true;
        }








         /* Authenticates the user using the PLAIN method.
         *
         * @param string The userid to authenticate as.
         * @param string The password to authenticate with.
         *
         * @return array Returns an array containing the response
         *
         * @access private
         * @since  1.0
         */
        function _authPLAIN($user, $pass  )
        {
            $cmd=sprintf('AUTH PLAIN %s', base64_encode( chr(0) . $user . chr(0) . $pass ) );

            if ( PEAR::isError( $ret = $this->_send($cmd) ) ) {
                return $ret;
            }
            if ( PEAR::isError( $challenge = $this->_recvLn() ) ){
                return $challenge;
            }
            if( PEAR::isError($ret=$this->_checkResponse($challenge) )){
                return $ret;
            }
           
            return true;
        }



         /* Authenticates the user using the PLAIN method.
         *
         * @param string The userid to authenticate as.
         * @param string The password to authenticate with.
         *
         * @return array Returns an array containing the response
         *
         * @access private
         * @since  1.0
         */
        function _authLOGIN($user, $pass  )
        {
            $this->_send('AUTH LOGIN');

            if ( PEAR::isError( $challenge = $this->_recvLn() ) ) {
                return $challenge;
            }
            if( PEAR::isError($ret=$this->_checkResponse($challenge) )){
                return $ret;
            }


            if ( PEAR::isError( $ret = $this->_send(sprintf('%s', base64_encode($user))) ) ) {
                return $ret;
            }

            if ( PEAR::isError( $challenge = $this->_recvLn() ) ) {
                return $challenge;
            }
            if( PEAR::isError($ret=$this->_checkResponse($challenge) )){
                return $ret;
            }

            if ( PEAR::isError( $ret = $this->_send(sprintf('%s', base64_encode($pass))) ) ) {
                return $ret;
            }

            if ( PEAR::isError( $challenge = $this->_recvLn() ) ) {
                return $challenge;
            }
            return $this->_checkResponse($challenge);
        }





         /* Authenticates the user using the CRAM-MD5 method.
         *
         * @param string The userid to authenticate as.
         * @param string The password to authenticate with.
         *
         * @return array Returns an array containing the response
         *
         * @access private
         * @since  1.0
         */
        function _authCRAM_MD5($uid, $pwd )
        {
            if ( PEAR::isError( $ret = $this->_send( 'AUTH CRAM-MD5' ) ) ) {
                return $ret;
            }

            if ( PEAR::isError( $challenge = $this->_recvLn() ) ) {
                return $challenge;
            }
            if( PEAR::isError($ret=$this->_checkResponse($challenge) )){
                return $ret;
            }

            // remove '+ '
           
            $challenge=substr($challenge,2);
           
            $challenge = base64_decode( $challenge );

            $cram = &Auth_SASL::factory('crammd5');
            $auth_str = base64_encode( $cram->getResponse( $uid , $pwd , $challenge ) );


            if ( PEAR::isError($error = $this->_send( $auth_str ) ) ) {
                return $error;
            }
            if ( PEAR::isError( $ret = $this->_recvLn() ) ) {
                return $ret;
            }
            //echo "RET:$ret\n";
            return $this->_checkResponse($ret);
        }



         /* Authenticates the user using the DIGEST-MD5 method.
         *
         * @param string The userid to authenticate as.
         * @param string The password to authenticate with.
         * @param string The efective user
         *
         * @return array Returns an array containing the response
         *
         * @access private
         * @since  1.0
         */
        function _authDigest_MD5($uid, $pwd)
        {
            if ( PEAR::isError( $ret = $this->_send( 'AUTH DIGEST-MD5' ) ) ) {
                return $ret;
            }

            if ( PEAR::isError( $challenge = $this->_recvLn() ) ) {
                return $challenge;
            }
            if( PEAR::isError($ret=$this->_checkResponse($challenge) )){
                return $ret;
            }

            // remove '+ '
            $challenge=substr($challenge,2);

            $challenge = base64_decode( $challenge );
            $digest = &Auth_SASL::factory('digestmd5');
            $auth_str = base64_encode($digest->getResponse($uid, $pwd, $challenge, "localhost", "pop3" ));

            if ( PEAR::isError($error = $this->_send( $auth_str ) ) ) {
                return $error;
            }

            if ( PEAR::isError( $challenge = $this->_recvLn() ) ) {
                return $challenge;
            }
            if( PEAR::isError($ret=$this->_checkResponse($challenge) )){
                return $ret;
            }
             /*
             * We don't use the protocol's third step because POP3 doesn't allow
             * subsequent authentication, so we just silently ignore it.
             */

            if ( PEAR::isError( $challenge = $this->_send("\r\n") ) ) {
                return $challenge ;
            }
           
            if ( PEAR::isError( $challenge = $this->_recvLn() ) ) {
                return $challenge;
            }
           
            return $this->_checkResponse($challenge);
           

        }










        /*
        * Sends the APOP command
        *
        * @param  $user Username to send
        * @param  $pass Password to send
        * @return bool Success/Failure
        */
        function _cmdApop($user, $pass)
        {
            if ($this->_state == NET_POP3_STATE_AUTHORISATION) {

                if (!empty($this->_timestamp)) {
                    if(PEAR::isError($data = $this->_sendCmd('APOP ' . $user . ' ' . md5($this->_timestamp . $pass)) ) ){
                        return $data;
                    }
                    $this->_state = NET_POP3_STATE_TRANSACTION;
                    return true;
                }
            }
            return $this->_raiseError('Not In NET_POP3_STATE_AUTHORISATION State1');
        }















        /*
        * Returns the raw headers of the specified message.
        *
        * @param  integer $msg_id Message number
        * @return mixed   Either raw headers or false on error
        */
        function getRawHeaders($msg_id)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                return $this->_cmdTop($msg_id, 0);
            }

            return false;
        }

        /*
        * Returns the  headers of the specified message in an
        * associative array. Array keys are the header names, array
        * values are the header values. In the case of multiple headers
        * having the same names, eg Received:, the array value will be
        * an indexed array of all the header values.
        *
        * @param  integer $msg_id Message number
        * @return mixed   Either array of headers or false on error
        */
        function getParsedHeaders($msg_id)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {

                $raw_headers = rtrim($this->getRawHeaders($msg_id));

                $raw_headers = preg_replace("/\r\n[ \t]+/", ' ', $raw_headers); // Unfold headers
                $raw_headers = explode("\r\n", $raw_headers);
                foreach ($raw_headers as $value) {
                    $name  = substr($value, 0, $pos = strpos($value, ':'));
                    $value = ltrim(substr($value, $pos + 1));
                    if (isset($headers[$name]) AND is_array($headers[$name])) {
                        $headers[$name][] = $value;
                    } elseif (isset($headers[$name])) {
                        $headers[$name] = array($headers[$name], $value);
                    } else {
                        $headers[$name] = $value;
                    }
                }

                return $headers;
            }

            return false;
        }

        /*
        * Returns the body of the message with given message number.
        *
        * @param  integer $msg_id Message number
        * @return mixed   Either message body or false on error
        */
        function getBody($msg_id)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                $msg = $this->_cmdRetr($msg_id);
                return substr($msg, strpos($msg, "\r\n\r\n")+4);
            }

            return false;
        }

        /*
        * Returns the entire message with given message number.
        *
        * @param  integer $msg_id Message number
        * @return mixed   Either entire message or false on error
        */
        function getMsg($msg_id)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                return $this->_cmdRetr($msg_id);
            }

            return false;
        }

        /*
        * Returns the size of the maildrop
        *
        * @return mixed Either size of maildrop or false on error
        */
        function getSize()
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                if (isset($this->_maildrop['size'])) {
                    return $this->_maildrop['size'];
                } else {
                    list(, $size) = $this->_cmdStat();
                    return $size;
                }
            }

            return false;
        }

        /*
        * Returns number of messages in this maildrop
        *
        * @return mixed Either number of messages or false on error
        */
        function numMsg()
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                if (isset($this->_maildrop['num_msg'])) {
                    return $this->_maildrop['num_msg'];
                } else {
                    list($num_msg, ) = $this->_cmdStat();
                    return $num_msg;
                }
            }

            return false;
        }

        /*
        * Marks a message for deletion. Only will be deleted if the
        * disconnect() method is called.
        *
        * @param  integer $msg_id Message to delete
        * @return bool Success/Failure
        */
        function deleteMsg($msg_id)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                return $this->_cmdDele($msg_id);
            }

            return false;
        }

        /*
        * Combination of LIST/UIDL commands, returns an array
        * of data
        *
        * @param  integer $msg_id Optional message number
        * @return mixed Array of data or false on error
        */
        function getListing($msg_id = null)
        {
       
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                if (!isset($msg_id)){
               
                    $list=array();
                    if ($list = $this->_cmdList()) {
                        if ($uidl = $this->_cmdUidl()) {
                            foreach ($uidl as $i => $value) {
                                $list[$i]['uidl'] = $value['uidl'];
                            }
                        }
                        return $list;
                    }else{
                        return array();
                    }
                } else {
                    if ($list = $this->_cmdList($msg_id) AND $uidl = $this->_cmdUidl($msg_id)) {
                        return array_merge($list, $uidl);
                    }
                }
            }

            return false;
        }

        /*
        * Sends the USER command
        *
        * @param  string $user Username to send
        * @return bool  Success/Failure
        */
        function _cmdUser($user)
        {
            if ($this->_state == NET_POP3_STATE_AUTHORISATION) {
                return $this->_sendCmd('USER ' . $user);
            }
            return $this->_raiseError('Not In NET_POP3_STATE_AUTHORISATION State');
        }


        /*
        * Sends the PASS command
        *
        * @param  string $pass Password to send
        * @return bool  Success/Failure
        */
        function _cmdPass($pass)
        {
            if ($this->_state == NET_POP3_STATE_AUTHORISATION) {
                return $this->_sendCmd('PASS ' . $pass);
            }
            return $this->_raiseError('Not In NET_POP3_STATE_AUTHORISATION State');
        }


        /*
        * Sends the STAT command
        *
        * @return mixed Indexed array of number of messages and
        *               maildrop size, or false on error.
        */
        function _cmdStat()
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                if(!PEAR::isError($data = $this->_sendCmd('STAT'))){
                    sscanf($data, '+OK %d %d', $msg_num, $size);
                    $this->_maildrop['num_msg'] = $msg_num;
                    $this->_maildrop['size']    = $size;

                    return array($msg_num, $size);
                }
            }
            return false;
        }


        /*
        * Sends the LIST command
        *
        * @param  integer $msg_id Optional message number
        * @return mixed   Indexed array of msg_id/msg size or
        *                 false on error
        */
        function _cmdList($msg_id = null)
        {
            $return=array();
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                if (!isset($msg_id)) {
                    if(!PEAR::isError($data = $this->_sendCmd('LIST') )){
                        $data = $this->_getMultiline();
                        $data = explode("\r\n", $data);                   
                        foreach ($data as $line) {
                            if($line !=''){
                                sscanf($line, '%s %s', $msg_id, $size);
                                $return[] = array('msg_id' => $msg_id, 'size' => $size);
                            }
                        }
                        return $return;
                    }
                } else {
                    if(!PEAR::isError($data = $this->_sendCmd('LIST ' . $msg_id))){
                        if($data!=''){
                            sscanf($data, '+OK %d %d', $msg_id, $size);
                            return array('msg_id' => $msg_id, 'size' => $size);
                        }
                        return array();
                    }
                }
            }
           

            return false;
        }


        /*
        * Sends the RETR command
        *
        * @param  integer $msg_id The message number to retrieve
        * @return mixed   The message or false on error
        */
        function _cmdRetr($msg_id)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                if(!PEAR::isError($data = $this->_sendCmd('RETR ' . $msg_id) )){
                    $data = $this->_getMultiline();
                    return $data;
                }
            }

            return false;
        }


        /*
        * Sends the DELE command
        *
        * @param  integer $msg_id Message number to mark as deleted
        * @return bool Success/Failure
        */
        function _cmdDele($msg_id)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                return $this->_sendCmd('DELE ' . $msg_id);
            }

            return false;
        }


        /*
        * Sends the NOOP command
        *
        * @return bool Success/Failure
        */
        function _cmdNoop()
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                if(!PEAR::isError($data = $this->_sendCmd('NOOP'))){
                    return true;
                }
            }

            return false;
        }

        /*
        * Sends the RSET command
        *
        * @return bool Success/Failure
        */
        function _cmdRset()
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {
                if(!PEAR::isError($data = $this->_sendCmd('RSET'))){
                    return true;
                }
            }

            return false;
        }

        /*
        * Sends the QUIT command
        *
        * @return bool Success/Failure
        */
        function _cmdQuit()
        {
            $data = $this->_sendCmd('QUIT');
            $this->_state = NET_POP3_STATE_DISCONNECTED;
            $this->_socket->disconnect();

            return (bool)$data;
        }


        /*
        * Sends the TOP command
        *
        * @param  integer  $msg_id    Message number
        * @param  integer  $num_lines Number of lines to retrieve
        * @return mixed Message data or false on error
        */
        function _cmdTop($msg_id, $num_lines)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {

                if(!PEAR::isError($data = $this->_sendCmd('TOP ' . $msg_id . ' ' . $num_lines))){
                    return $this->_getMultiline();
                }
            }

            return false;
        }

        /*
        * Sends the UIDL command
        *
        * @param  integer $msg_id Message number
        * @return mixed indexed array of msg_id/uidl or false on error
        */
        function _cmdUidl($msg_id = null)
        {
            if ($this->_state == NET_POP3_STATE_TRANSACTION) {

                if (!isset($msg_id)) {
                    if(!PEAR::isError($data = $this->_sendCmd('UIDL') )){
                        $data = $this->_getMultiline();
                        $data = explode("\r\n", $data);
                        foreach ($data as $line) {
                            sscanf($line, '%d %s', $msg_id, $uidl);
                            $return[] = array('msg_id' => $msg_id, 'uidl' => $uidl);
                        }

                        return $return;
                    }
                } else {

                    $data = $this->_sendCmd('UIDL ' . $msg_id);
                    sscanf($data, '+OK %d %s', $msg_id, $uidl);
                    return array('msg_id' => $msg_id, 'uidl' => $uidl);
                }
            }

            return false;
        }









        /*
        * Sends a command, checks the reponse, and
        * if good returns the reponse, other wise
        * returns false.
        *
        * @param  string $cmd  Command to send (\r\n will be appended)
        * @return mixed First line of response if successful, otherwise false
        */
        function _sendCmd($cmd)
        {
            if (PEAR::isError($result = $this->_send($cmd) )){
                return $result ;
            }

            if (PEAR::isError($data = $this->_recvLn() )){
                return $data;
            }
           
            if ( strtoupper(substr($data, 0, 3)) == '+OK') {
                return $data;
            }
           
           
            return $this->_raiseError($data);
        }

        /*
        * Reads a multiline reponse and returns the data
        *
        * @return string The reponse.
        */
        function _getMultiline()
        {
            $data = '';
            while(!PEAR::isError($tmp = $this->_recvLn() ) ) {
                if($tmp == '.'){
                    return substr($data, 0, -2);
                }
                if (substr($tmp, 0, 2) == '..') {
                    $tmp = substr($tmp, 1);
                }
                $data .= $tmp . "\r\n";
            }
            return substr($data, 0, -2);
        }


       /**
        * Sets the bebug state
        *
        * @param  bool $debug
        * @access public
        * @return void
        */
        function setDebug($debug=true)
        {
            $this->_debug=$debug;
        }





       /**
         * Send the given string of data to the server.
         *
         * @param   string  $data       The string of data to send.
         *
         * @return  mixed   True on success or a PEAR_Error object on failure.
         *
         * @access  private
         * @since   1.0
         */
        function _send($data)
        {
            if ($this->_debug) {
                echo "C: $data\n";
            }

            if (PEAR::isError($error = $this->_socket->writeLine($data))) {
                return $this->_raiseError('Failed to write to socket: ' . $error->getMessage());
            }
            return true;
        }



         /**
         * Receive the given string of data from the server.
         *
         * @return  mixed   a line of response on success or a PEAR_Error object on failure.
         *
         * @access  private
         * @since  1.0
         */
        function _recvLn()
        {
            if (PEAR::isError( $lastline = $this->_socket->readLine( 8192 ) ) ) {
                return $this->_raiseError('Failed to write to socket: ' . $this->lastline->getMessage() );
            }
            if($this->_debug){
                // S: means this data was sent by  the POP3 Server
                echo "S:$lastline\n" ;
            }
            return $lastline;
        }

         /**
         * Checks de server Response
         *
         * @param  string $response the response
         * @return  mixed   true on success or a PEAR_Error object on failure.
         *
         * @access  private
         * @since  1.3.3
         */

        function _checkResponse($response)
        {
            if (@substr(strtoupper($response), 0, 3) == '+OK') {
                return true;
            }else{
                if (@substr(strtoupper($response), 0, 4) == '-ERR') {
                    return $this->_raiseError($response);
                }else{
                    if (@substr(strtoupper($response), 0, 2) == '+ ') {
                        return true;
                    }
                }
       
            }
            return $this->_raiseError("Unknown Response ($response)");
        }
       


    }

    ?>


    and in the new processbounces.php file I changed from
    include('Net/POP3.php');


    to

    include('POP3.php');
    afeuer
    phpLister
     
    Posts: 5
    Joined: 12:47am, Thu 22 Dec, 2005

    Postby warmbells » 10:32pm, Sat 23 Sep, 2006

    Bit of a newbie.

    Is anything in the above script user specific or does it pick up the variables from PHPList?

    Gerald
    warmbells
    phpLister
     
    Posts: 5
    Joined: 10:46pm, Fri 18 Aug, 2006
    Location: Swinton, Greater Manchester, England

    Login problem after installing this script

    Postby Dar-us-Salam.com » 5:23am, Wed 07 Feb, 2007

    After configuring this script on my installation it seems to have messed up the system as it keeps asking me to login on every page. I think that this solution may not be applicable to the latest phpList version 2.10.4 which I have. I don't know how to fix this problem.

    I have restored all the original files that I changed but the login problem still exists and I still can't process the bounces automatically. Anyone have a solution to this login problem and an alternate to IMAP?

    Thanks
    Omar Waheed
    Dar-us-Salam.com
    phpLister
     
    Posts: 6
    Joined: 3:35am, Fri 26 Jan, 2007

    Login OK but not POP3

    Postby Dar-us-Salam.com » 4:47am, Thu 08 Feb, 2007

    I was able to fix the login problem but the POP3 is still not working. I followed all the directions on this page and replaced the processbounces.php file with the code provided and created a POP3.php file in the admin directory with the code in the second post.

    Now whenever I click 'Process Bounces' it only loads the page up to the language drop down mention and the rest of the page is blank. It doesn't give any message. I think it stops somewhere in the POP3.php file (following the include statement).

    Can someone please advise if this alternative can work with my current installation, and if so how can I make it work?

    Thanks
    Dar-us-Salam.com
    phpLister
     
    Posts: 6
    Joined: 3:35am, Fri 26 Jan, 2007

    Postby nd_oliveira » 4:35pm, Fri 21 Sep, 2007

    After you install POP3.php there are 2 more dependencies packages:
    - Socket.php
    - PEAR.php

    open these pages and verify the include path...
    nd_oliveira
    phpList newbie
     
    Posts: 1
    Joined: 4:59pm, Thu 20 Sep, 2007

    Re: I got it to work

    Postby thuypn » 8:20am, Tue 09 Oct, 2007

    [quote="afeuer"]I made the following modification and it work:
    Hi,
    I have problems with phplist hosting by Godaddy because they don't support IMAP. Thanks for your code.
    After using this guide, mosts likes ok except Process bounces.
    one mail was created on Godaddy and ok when checked by webmail, but always show error: error:
    Wrong username or password(noreply@mydomain,mypassword) for pop.secureserver.net:110/pop3 Generic login error

    My Hosting plan is Deluxy, and can't edit socket.php and PEAR.php as you showed.
    --------
    Pls help me if you can.

    Thanks
    ---------------
    thuypn
    phpLister
     
    Posts: 6
    Joined: 7:55am, Tue 09 Oct, 2007

    phplist v2.10.5 bounce processing patch.

    Postby bashconsole » 10:53pm, Fri 09 Nov, 2007

    Please, download 100% working patch from here

    bashconsole.com/downloads.html

    Patch was tested with phplist version 2.10.4-2.10.5


    Have a nice day!


    EDIT by MODERATOR (14-01-2010):
    In order to secure future availability of bashconsole's patch I included this file here, including his comments:
    bashconsole wrote:phplist v2.10.5 bounce processing patch.
    Patch for bounces processing using PEAR for everyone not having the php-IMAP extension installed (a lot of hosting services doesn't have it).
    Patch was tested with phplist version 2.10.4-2.10.5
    and according to this article it works fine for version 2.10.8 also.

    bounces-pear-2.10.5.tar.bz2.zip
    phplist v2.10.5 bounce processing patch
    by bashconsole
    (20.4 KiB) Downloaded 640 times

    Source: http://bashconsole.com/downloads.html
    bashconsole
    phpList newbie
     
    Posts: 1
    Joined: 8:38pm, Fri 09 Nov, 2007

    Re: phplist v2.10.5 bounce processing patch.

    Postby thuypn » 11:07am, Sun 18 Nov, 2007

    Thanks a lots, bashconsole.
    But i had changed to another hosting server because when send newsletter process is running and it always killed by godaddy.
    thuypn
    phpLister
     
    Posts: 6
    Joined: 7:55am, Tue 09 Oct, 2007

    google domain hosted email & no IMAP support on server

    Postby m1bxd » 11:28pm, Sun 30 Dec, 2007

    http://bashconsole.com/downloads.html

    Working
    phplist - version 2.10.5
    debian etch

    Bach thanks for the code above! Here is my contribution if you want it to work with a google domain hosted email which you use a POP3 enable account:

    install bashconsole's patch above and then mod config.php as follows:

    Code: Select all
    # when the protocol is pop, specify these three
    $bounce_mailbox_host = 'ssl://pop.gmail.com';
    $bounce_mailbox_user = 'username@yourdomain.co.uk';
    $bounce_mailbox_password = 'password';

    # the "port" is the remote port of the connection to retrieve the emails
    # the default should be fine but if it doesn't work, you can try the second
    # one. To do that, add a # before the first line and take off the one before the
    # second line

    $bounce_mailbox_port = "995/pop3/ssl";


    and modify this line in ../admin/processbounces.php

    Code: Select all
    $port = '110/pop3/notls';

    to
    Code: Select all
    $port = '995/pop3/ssl';


    I just didn't fancy bringing my server down to compile php with ssl in, I'm not running a mailserver to drive me mad, so it went for the work around

    Cheers Mark :lol:
    m1bxd
    phpList newbie
     
    Posts: 2
    Joined: 10:59pm, Sun 30 Dec, 2007

    Re: phplist v2.10.5 bounce processing patch.

    Postby kwixson » 4:37am, Wed 25 Jun, 2008

    bashconsole wrote:Please, download 100% working patch from here

    bashconsole. com/downloads.html

    Patch was tested with phplist version 2.10.4-2.10.5


    Have a nice day!


    I have the same problem with this as the other user who cited the error "Wrong username or password...Generic login error"

    I have set up the bounce address account with an email client and confirmed I'm using the right settings to access the POP account. I have downloaded the package quoted above and put in in the default installation path. Everything should be GO, but no joy. Running version 2.10.5 What do I do now?

    Apart from bounce processing, everything seems to be working.
    kwixson
    phpLister
     
    Posts: 8
    Joined: 5:39pm, Thu 22 Sep, 2005

    Postby dadaodd » 10:16am, Wed 25 Jun, 2008

    Anyone processed bounces successfully with Godaddy shared hosting?
    dadaodd
    phpList newbie
     
    Posts: 2
    Joined: 2:35am, Wed 25 Jun, 2008

    Next

    Return to Contributions: Plug-ins, Add-ons, Mods

    Who is online

    Users browsing this forum: No registered users and 0 guests