February 05, 2014

8:14 a.m.
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(
    "[email protected]",
    "[email protected]",

$mail = new Zend_Mail_Storage_Pop3(array('host' => 'pop3.example.com', 'user' => '[email protected]', '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