Posts Tagged ‘pop3

అందుకుంటారు మరియు POP3 మరియు PHP ఉపయోగించి ఇమెయిళ్ళను విశ్లేషించడం ఎలా

మార్చి 1 వ, 2010

నేను ఇన్కమింగ్ మెయిల్ కోసం ప్రాసెసర్ రాయడానికి ఎలా కొన్ని పద్దతులను వివరించడానికి కోరుకుంటున్నారో. నేను అలాంటి తారుమారు ఉపయోగించాల్సి వచ్చింది ఇ-మెయిల్స్ అన్వయించడం వివిధ వనరులనుంచి అందుకున్న. ఈ మీ స్వంత స్పామ్ వడపోత వ్యవస్థ రాయడం ఉపయోగపడుతుందని, ఆన్సరింగ్ మెషీన్ లేదా టిక్కెట్ సిస్టమ్ ఇ-మెయిల్ ద్వారా అప్లికేషన్లు అందుకున్న.

ఇ-మెయిల్ పార్సర్ అల్గారిథమ్ మేము అవసరం అమలు

  1. కనెక్ట్ అయ్యేందుకు మరియు లాగ్ ఆన్ ఇ-మెయిల్ సర్వర్
  2. ఇన్కమింగ్ అక్షరాల సంఖ్య లెక్కింపు
  3. POP3 ప్రోటోకాల్ను ఉపయోగించి సర్వర్ నుండి ఇ-మెయిల్ recive
  4. ఇ-మెయిల్ శీర్షికలు మరియు శరీరం ప్రాసెస్ మరియు పదనిరూపణ చేయడానికి
  5. … ఏ అదనపు చర్యలు అమలు

అలాగే, చాలా నిర్దిష్ట పని ఉంది PHP కోడింగ్, కాబట్టి మేము హోస్టింగ్ అవసరం బాహ్య కనెక్షన్ మద్దతు. చక్కని ఇప్పటికే ప్రతిభావంతులైన ప్రోగ్రామర్లు గ్రహించారు చేయబడింది పూర్తిగా ఎందుకంటే నేను నిర్ణయం వ్రాయడానికి ప్రతిపాదించారు లేదు. ఉదాహరణకి, 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