Thursday, May 19, 2022

Anti-spam filter in PHP


<?php

function is_base64($s)
{
      return (bool) preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $s);
}

$user = "info@rubirosa.rs";
$pass = "djole123";

//$imap = imap_open("{mail.rubirosa.rs:995/pop3/ssl/novalidate-cert}", $user, $pass);
//$imap = imap_open("{mail.rubirosa.rs:995/pop3/ssl/novalidate-cert}INBOX", $user, $pass);


$imap = imap_open("{mail.rubirosa.rs:110/pop3/notls}", $user, $pass);

//imap_delete($imap, 1);

if( $imap ) {
   
     //Check no.of.msgs
     $num = imap_num_msg($imap);

for ($x = 1; $x <= $num; $x++) {
  echo "The number is: $x <br>";
//  echo imap_qprint(imap_body($imap, $x));

$s= imap_qprint(imap_body($imap, $x));

if (is_base64($s)) {

  echo base64_decode($s);
}
else
{
  echo $s;
}
 
  echo "<hr>";
 
  $header = imap_header($imap, $x);
$from = $header->from;
foreach ($from as $id => $object) {
    $fromname = $object->personal;
    $fromaddress = $object->mailbox . "@" . $object->host;

echo $fromname . "<br>";
echo $fromaddress;

}

  echo "<hr>";

}

/*

imap_delete($imap, 1);  //mark first message for delete

imap_expunge($imap);    //delete marked message

*/

     //close the stream
     imap_close($imap);
}

?>




PREY GAME FOR FREE:


OCR Goodies:


No comments:

Post a Comment

Коментар: