Posts Tagged ‘parse e-posta’

Nasıl almak ve e-posta ile parse POP3 ve PHP

1 Mart, 2010

Ben gelen posta için işlemci yazmak için bazı yöntemleri anlatmak isterim. Böyle manipülasyon için kullanmak zorundayım parse e-postaları Çeşitli kaynaklardan alınan. Bu yararlı kendi spam filtre sistemi yazmak için olabilir, telesekreter veya bilet sistemi e başvurmasını-posta.

İhtiyacımız e-posta ayrıştırıcı algoritma için

  1. ve log-on e-posta sunucusuna bağlanıp
  2. Gelen mektuplar sayısını
  3. sunucudan recive e-posta POP3 protokolünü kullanarak
  4. işlem e-posta başlıklarını ve vücut ve ayrıştırma yapmak
  5. … Herhangi bir ek eylemler uygulamak

Ok, orada çok özel bir görev için PHP kodlama, bu nedenle harici bağlantı destekleyen hosting gerek. Ben karar tamamen çok yetenekli programcılar zaten gerçekleştirildi çünkü yazmak için teklif yok. Örneğin, e kabul sağlayacak hazır modülü alabilir-uzak bir sunucudan postaları.

Manuel Lemos ve müzik ederiz onun modülü (php class) hangi pop3.php adli.

kodunuza bu sınıf bağlanmak için, Sadece kullanma katmak veya komut gerektirir gerek: istemek(“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($kullanıcı,$accesscode,$apop);
eğer ($hata<>'Parola hatası: Oturum açma hatası: bilinmeyen kullanıcı adı veya hatalı parola. ') {echo $error; çıkış;}
// Now get the statistic how many emails are stored and the size of them $result=$pop3_connection->Statistics($messages, $size);
yankı "$hostname contains  $messages in $size bytes.";

//..... biz e alabilir var-döngüsünde postaları ve parse .... //

// bir şey varsa yapmak - we can close the connection
$error=$pop3_connection->Close(); //
echo $error;
?>

Şimdi nasıl bağlamak için know log-on POP3 sunucusuna nasıl ve boyutları Gelen e-postaların sayısını isteyecek. Sonraki, biz her e-posta alacaksınız ve başlıklarını ve vücut dizi parse.

Devam edecek

Paylaşma ve tadını çıkarın

  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP
  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP
  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP
  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP
  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP
  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP
  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP
  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP
  • wp socializer sprite mask 16px How to receive and parse emails using POP3 and PHP