Thursday, April 28, 2022

pop3 check php



Potreban i dovoljan uslov: 

https://stackoverflow.com/questions/9654453/fatal-error-call-to-undefined-function-imap-open-in-php


Prvo koristimo:

https://www.php.net/manual/en/function.imap-body.php

da preuzmemo mejlove, a zatim naredbu za brisanje odredjenog mejla koji je sumnjiv, na primer ima nedozvoljeni tip fajla ili sadržaj:


imap_delete($mbox1);

https://www.tutorialspoint.com/php/php_functions_imap_delete.htm

https://www.php.net/manual/en/function.imap-delete.php



PRIMER:

<?php
$user = "miki@rubirosa.rs";
$pass = "RamboAmadeus";

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

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

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

//imap_delete($imap, 1); //Delete first msg


/*
     if( $num >0 ) {
          echo imap_qprint(imap_body($imap, $num));
     }
*/



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


Malo bolje:

<?php
$user = "info@rubirosa.rs";
$pass = "Milena123";

//$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);


if( $imap ) {
   
     //Check no.of.msgs
     $num = imap_num_msg($imap);
     
$header = imap_header($imap, $x);
$from = $header->from;
foreach ($from as $id => $object) {
    $fromname = $object->personal;
    $fromaddress = $object->mailbox . "@" . $object->host;
}    
     
     

for ($x = 1; $x <= $num; $x++) {
  echo "The number is: $x <br>";
  echo imap_qprint(imap_body($imap, $x));
  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 imap_qprint(imap_header($imap, $x));


  echo "<hr>";



}

//imap_delete($imap, 1);

/*
     if( $num >0 ) {
          echo imap_qprint(imap_body($imap, $num));
     }
*/



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

Gore navedeno su osnovne stvari koje su potrebne ako želite da napravite antispam online servis.

by:
https://vsc-rs.blogspot.com/2022/05/vscrs-programming-website.html


FREE VPN OF YOURS:



THE BRAND NEW KDE distro:


An independent RLXOS:


An Italian Linux for Academia:


++



No comments:

Post a Comment

Коментар: