February 05, 2014

In this article, we are going to discuss about how to create POP3 filter in PHP using Zend Framework. POP3 is nothing but Post Office Protocol (POP) is an application-layer Internet standard protocol used by local e-mail clients to retrieve e-mail from a remote server over a TCP/IP connection. It is mostly used to send and receive an Email in an application. I'm going to explain about how to create POP3 filter in php using Zend framework.

Create a file in the server named "pop3filter.php" and add the below codes in that file.

require_once 'Zend/Mail/Storage/Pop3.php';

$spammers = array(

$mail = new Zend_Mail_Storage_Pop3(array('host' => 'pop3.example.com', 'user' => 'john.doe@example.com', 'password' => 'example', 'port' => 110));

echo $mail->countMessages() . " messages found\n";

foreach ($mail as $messageId => $message) {
  echo "{$messageId} : Mail from '{$message->from}': {$message->subject}\n";

  if(in_array(strtolower($message->from), $spammers, true)) {
    echo "Message removed\n";



$ crontab -e
# m h  dom mon dow   command
*/10 * * * * /usr/bin/php /home/john/bin/pop3filter/pop3filter.php > /dev/null 2>&1


Post a Comment