Ki jan yo resevwa ak parse Imel le li sevi avek POP3 ak PHP

Mas 1st, 2010 pa admin kite yon repons »

Mwen ta renmen dekri kek metod sou ki jan yo ekri processeur a pou lapos fek ap rantre. Mwen te oblije sevi ak manipilasyon sa yo parse e li te resevwa nan plizye sous. Sa a ka itil pou ekri pwop sistem filtre Spam ou, reponn machin oswa sistem tike pou resevwa aplikasyon pa e-mail.

Pou aplike algorithm parser e-mail nou bezwen

  1. konekte ak boutey-sou seve e-mail
  2. konte kantite let fek ap rantre
  3. repetitif e-mail soti nan seve a le li sevi avek POP3 pwotokol
  4. pwosesis tet yo e-mail ak ko epi fe parsing
  5. … aplike nenpot aksyon adisyonel

Oke, gen travay tre espesifik pou PHP kodaj, se konsa, nou bezwen hosting ki sipote koneksyon eksten. I do not propose to write decision entirely because much has been realized by talented programmers already. Pa egzanp, you can take a ready module which will allow accept e-mails from a remote server.

Thank’s to Manuel Lemos and his module (php class) which named pop3.php.

To connect that class to your code, you just need to use include or require command: require(“pop3.php”);


hostname=$hostname;
$result=$pop3_connection->Open();
 
// We are trying to open connection and display the result
echo $result;
// Trying to logon and display the error if any appear
$error=$pop3_connection->Login($user,$accesscode,$apop);
if ($error<>'Password error: Logon failure: unknown user name or bad password.') {echo $error; exit;}
// Now get the statistic how many emails are stored and the size of them $result=$pop3_connection->Statistics($messages, $size);
echo "$hostname contains  $messages of $size bytes.";
 
//..... There we can receive e-mails in the cycle and parse them.... //
 
// If nothing to do - we can close the connection
$error=$pop3_connection->Close(); //
echo $error;
?>

Now we know how to connect and log-on to the POP3 server and how to request the number of Inbox e-mails and them sizes. Next, we should receive each e-mail and parse the headers and body array.

TO BE CONTINUED

Reklam

3 comments

  1. gold te di:

    Great, that is working, what now? How to receive the e-mail? How to write e-mail parser? Continue please, great post!

  2. Waipahu locksmith te di:

    Fantastic Post. I have read many posts on this subject and you done the best job. Keep it up!

  3. web application technology te di:

    You can not believe just how long ive been googling because of this. Atrave set paj nan rezilta fouye ak jwenn anyen. 1 rechech sou Msn. Gen sa a se… Gotta komanse le li sevi avek sa a pi souvan ebrantley@KC.rr.com

kite yon repons

Ou dwe connecté pou afiche yon kòmantè de.