«
«
Kullanıcı Masası
Hoşgeldin Ziyaretçi

Kategoriler
PHP IMAP-POP3 Mail Sınıfı

PHP IMAP-POP3 Sınıfı Hakkında



Bundan birkaç sene önce bir Imap/Pop3 sınıfı hazırlamıştım, aslında bir e-posta dağıtması sitesi açmak istiyordum fakat nasip olmadı. Uzun zamandır arşivimde öylece bekleyen bu php sınıfını sizlerle paylaşmak istedim, eğer aklınızda bir webmail veya benzeri bir uygulama yapmak varsa bu sınıf fazlasıyla işinizi görecektir.


PHP Sınıfı



Kod Çizelgesi:[Hepsini Seç] 

Class BLSEPOSTA
{
    // Public $Host = '{mail.siteadi.com:995/pop3/ssl/novalidate-cert}';
    Public $Host '{mail.siteadi.com:993/imap/ssl/novalidate-cert}';
    Static $Kullanici "[email protected]";
    Static $Sifre "123456789";
    Static $EpostaDurumKlasor "INBOX";
    Static $Klasor "INBOX";
    Static $PKutusu "INBOX";
    Public $Baglanti;
    Private $Hata;
    Private $Durum;
    Private $DosyaKonumu "./dosyalar/";
    Private $ResimKonumu "./resimler/";

    

    Static function ayar$gelen$deger null )
    {
        if( is_array$gelen ) )
        {
            foreach( $gelen as $key => $deger )
            {
                self::ayar$key$deger );
            }
        }
        else if( property_exists__CLASS__$gelen ) ) 
        {
            self::$$gelen $deger;
        }
    }
    
    function __construct(){ 
        try{
            // BAĞLANTI YAPILIYOR
            $this->Baglanti = @imap_open($this->Host.self::$PKutusuself::$Kullaniciself::$Sifre);
            
            // BAĞLANTI YAPILAMAZSA EKRANA BİLGİ YAZDIRILIYOR
            if(!$this->Baglanti){
                throw new Exception ("<table style='padding: 2px; border: 1px solid darkred; background-color: #ffd0d0; font-family: Verdana; font-size: 10px;' align='center'><tr><td><b>E-Posta Bağlantı Hatası:</b> Bağlantı yapılamadı!
<br><center>".imap_last_error()."</center></td></tr></table>");
            }
            
            
            // ÜYESİ OLUNAN POSTA KUTULARI ÇEKİLİYOR
            $klasor_modu 0;
            $Klasor imap_listmailbox($this->Baglanti$this->Host"*");

            if(=== $this->VarsayilanKlasorleriOlustur($this->Baglanti,$Klasor)) {
                $Klasor imap_listmailbox($this->Baglanti$this->Host"*");
                $klasor_modu 1;
            }

            sort($Klasor);

            $Klasor str_replace($this->Host,'',$Klasor);
            $this->Klasor $Klasor;
            // ÜYESİ OLUNAN POSTA KUTULARI ÇEKİLİYOR - SONU    

        }    
        // BAĞLANTI YAPILAMAZSA EKRANA BİLGİ YAZDIRILIYOR
        catch (Exception $Hata){
            die($Hata->getMessage());
            exit();
        } 
    }
    
    
    // VARSAYILAN KLASÖRLER OLUŞTURULUYOR
    private function VarsayilanKlasorleriOlustur($imap_baglantisi$Klasor) {
        $durum=0;
        if(!in_array($this->Host.'INBOX.Trash',$Klasor)) {
            @imap_createmailbox($imap_baglantisiimap_utf7_encode($this->Host."INBOX.Trash"));
            $durum=1;
        }
        if(!in_array($this->Host.'INBOX.Sent',$Klasor)) {
            @imap_createmailbox($imap_baglantisiimap_utf7_encode($this->Host."INBOX.Sent"));
            $durum=1;
        }
        if(!in_array($this->Host.'INBOX.Drafts',$Klasor)) {
            @imap_createmailbox($imap_baglantisiimap_utf7_encode($this->Host."INBOX.Drafts"));
            $durum=1;
        }
        if(!in_array($this->Host.'INBOX.Junk',$Klasor)) {
            @imap_createmailbox($imap_baglantisiimap_utf7_encode($this->Host."INBOX.Junk"));
            $durum=1;
        }
        return $durum;
    }
   // VARSAYILAN KLASÖRLER OLUŞTURULUYOR - SONU
    
    
    // KLASÖR, ÖRNEĞİN: INBOX
    Public function EpostaDurum($PostaKutusu)
    {
        // BAĞLANTI YAPILIYOR
        $this->Durum imap_status($this->Baglanti$this->Host.$PostaKutusuSA_ALL);
        try{

            $EpostaDurum = array(
            'ileti_sayisi' => $this->Durum->messages,
            'yeni_gelenler' => $this->Durum->recent,
            'okunmamislar' => $this->Durum->unseen,
            'sonraki_kimlik' => $this->Durum->uidnext,
            'kimlik_gecerlimi' => $this->Durum->uidvalidity
            );
                    
            // BAĞLANTI YAPILAMAZSA EKRANA BİLGİ YAZDIRILIYOR
            if(!$this->Durum){
                throw new Exception ("<table style='padding: 2px; border: 1px solid darkred; background-color: #ffd0d0; font-family: Verdana; font-size: 10px;' align='center'><tr><td><b>E-Posta IMAP_STATUS Bağlantı Hatası:</b> Bağlantı yapılamadı!
<br><center>".imap_last_error()."</center></td></tr></table>");
            }
            
            return $EpostaDurum;
        }    
        // BAĞLANTI YAPILAMAZSA EKRANA BİLGİ YAZDIRILIYOR
        catch (Exception $Hata){
            die($Hata->getMessage());
            exit();
        }
        
    }
    
    
    // KLASÖR, ÖRNEĞİN: INBOX
    Public function EpostaAdet($PostaKutusu)
    {
        $this->Durum = @imap_status($this->Baglanti$this->Host.$PostaKutusuSA_ALL);
        $EpostaDurum = ('('.$this->Durum->unseen.')');
        
        if($EpostaDurum == '(0)') return '';
        else return $EpostaDurum;
    }
    
    // POSTA KUTUSUNU KONTROL ET
    public function PostaKutusuKontrol() {
        return imap_check($this->Baglanti);
    }

    // POSTA KUTULARINDA ARAMA YAP
    public function PostaKutusuArama($kriter 'ALL') {
        $postaNumaralari imap_search($this->Baglanti$kriterSE_UID"UTF-8");
        return $postaNumaralari $postaNumaralari : array();
    }
     
    // POSTA KUTUSU SİL
    public function PostaKutusuAdiDegistir($KutuAdi$KutuYeniAdi) {
        $KutuYeniAdi imap_utf7_encode($this->Host.$KutuYeniAdi);
        return imap_renamemailbox($this->Baglanti$this->Host.$KutuAdi$KutuYeniAdi);
    }
    
    // POSTA KUTUSU SİL
    public function PostaKutusuSil($KutuAdi) {
        return imap_deletemailbox($this->Baglanti$this->Host.$KutuAdi);
    }
    
    // E-POSTAYI SİL
    public function PostayiSil($postaNumarasi) {
        return imap_delete($this->Baglanti$postaNumarasiFT_UID);
    }

    // E-POSTAYI TAŞI
    public function PostaTasi($postaNumarasi$postaKutusu) {
        return imap_mail_move($this->Baglanti$postaNumarasi$postaKutusuCP_UID) &amp;&amp$this->SilinenPostalariTemizle();
    }

    // SİLİNEN E-POSTALARI SUNUCUDAN TEMİZLE ( TAMAMEN SİL )
    public function SilinenPostalariTemizle() {
        return imap_expunge($this->Baglanti);
    }

    // E-POSTALARI OKUNMADI OLARAK İŞARETLE
    public function PostalarOkunmadi(array $postaNumarasi) {
        return $this->BayrakTemizle($postaNumarasi'\\Seen');
    }
    
    // E-POSTALARI OKUNDU OLARAK İŞARETLE
    public function PostalarOkundu(array $postaNumarasi) {
        return $this->BayrakAyarla($postaNumarasi'\\Seen');
    }
    
    // E-POSTALARI ÖNEMSİZ OLARAK İŞARETLE
    public function OnemsizPostalar(array $postaNumarasi) {
        return $this->BayrakTemizle($postaNumarasi'\\Seen');
    }
    
    // E-POSTALARI ÖNEMLİ OLARAK İŞARETLE
    public function OnemliPostalar(array $postaNumarasi) {
        return $this->BayrakAyarla($postaNumarasi'\\Flagged');
    }

    // BAYRAK AYARLA
    public function BayrakAyarla(array $postaNumaralari$bayrak) {
        return imap_setflag_full($this->Baglantiimplode(','$postaNumaralari), $bayrakST_UID);
    }

    // BAYRAK TEMİZLE
    public function BayrakTemizle(array $postaNumaralari$bayrak) {
        return imap_clearflag_full($this->Baglantiimplode(','$postaNumaralari), $bayrakST_UID);
    }

    // E-POSTA BİLGİLERİNİ AL
    public function PostaBilgileriniAl(array $postaNumaralari) {
        return imap_fetch_overview($this->Baglantiimplode(','$postaNumaralari), FT_UID);
    }

    // POSTA KUTUSU BİLGİSİ
    public function PostaKutusuBilgisi() {
        return imap_mailboxmsginfo($this->Baglanti);
    }

    // E-POSTA SIRALA
    public function EpostalariSirala($kriter SORTARRIVAL$tersten true) {
        return imap_sort($this->Baglanti$kriter$terstenSE_UID);
    }


    // TOPLAM E-POSTA SAYISI
    public function ToplamMail() {
        return imap_num_msg($this->Baglanti);
    }

    // E-POSTA EŞSİZ NUMARASI
    public function MailUid($iletino) {
        return imap_uid($this->Baglanti,$iletino);
    }
    
    // E-POSTA EŞSİZ NUMARASI
    public function MailMsgId($uidno) {
        return imap_msgno($this->Baglanti,$uidno);
    }

    // E-POSTA ALANI
    protected function EpostaAlani() {
        return imap_get_quotaroot($this->Baglanti'INBOX');
    }

    // KULLANICIYA VERİLEN E-POSTA LİMİTİ
    public function EpostaLimiti() {
        $alan $this->EpostaAlani();
        if (is_array($alan)) {
            $alan $alan['STORAGE']['limit'];
        }
        return $alan;
    }

    // KULLANICININ KULLANDIĞI E-POSTA ALANI
    public function KullanilanAlan() {
        $alan $this->EpostaAlani();
        if (is_array($alan)) {
            $alan $alan['STORAGE']['usage'];
        }
        return $alan;
    }
    
    public function decodeMimeStr($string$charset 'UTF-8') {
        $newString '';
        $elements imap_mime_header_decode($string);
        for($i 0$i count($elements); $i++) {
            if($elements[$i]->charset == 'default') {
                $elements[$i]->charset 'UTF-8';
            }
            $newString .= @iconv(strtoupper($elements[$i]->charset), $charset$elements[$i]->text);
        }
        return $newString;
    }

    public function isUrlEncoded($string) {
        $string str_replace('%20''+'$string);
        $decoded urldecode($string);
        return $decoded != $string &amp;&ampurlencode($decoded) == $string;
    }

    public function decodeRFC2231($string$charset 'UTF-8') {
        if(preg_match("/^(.*?)'.*?'(.*?)$/"$string$matches)) {
            $encoding $matches[1];
            $data $matches[2];
            if($this->isUrlEncoded($data)) {
                $string = @iconv(strtoupper($encoding), $charseturldecode($data));
            }
        }
        return $string;
    }
    
        
    // ZARARLI VERİLER TEMİZLENİYOR
    public function TakCevirici($metin)
    {

        $bul = array('>''<''{''}');
        
        $cevir = array('>''<''{''}');
        
        $donen = @str_replace($bul$cevir$metin);

        return $donen;
    }
    
    public function YaziDuzelt($gelen)
    {

        $degistir = array();   $bul   = array();     $bul2 = array();


        $degistir[] = "À";   $bul[] = "À";     $bul2[] = "À";
        $degistir[] = "Á";   $bul[] = "Á";     $bul2[] = "Á";
        $degistir[] = "Â";   $bul[] = "Â";     $bul2[] = "Â";
        $degistir[] = "Ã";   $bul[] = "Ã";     $bul2[] = "Ã";
        $degistir[] = "Ä";   $bul[] = "Ä";     $bul2[] = "Ä";
        $degistir[] = "Å";   $bul[] = "Å";     $bul2[] = "Å";
        $degistir[] = "Æ";   $bul[] = "Æ";     $bul2[] = "Æ";
        $degistir[] = "Ç";   $bul[] = "Ç";     $bul2[] = "Ç";
        $degistir[] = "È";   $bul[] = "È";     $bul2[] = "È";
        $degistir[] = "É";   $bul[] = "É";     $bul2[] = "É";
        $degistir[] = "Ê";   $bul[] = "Ê";     $bul2[] = "Ê";
        $degistir[] = "Ë";   $bul[] = "Ë";     $bul2[] = "Ë";
        $degistir[] = "Ì";   $bul[] = "Ì";     $bul2[] = "Ì";
        $degistir[] = "Í";   $bul[] = "Í";     $bul2[] = "Í";
        $degistir[] = "Î";   $bul[] = "Î";     $bul2[] = "Î";
        $degistir[] = "Ï";   $bul[] = "Ï";     $bul2[] = "Ï";
        $degistir[] = "Ñ";   $bul[] = "Ñ";     $bul2[] = "Ñ";
        $degistir[] = "Ò";   $bul[] = "Ò";     $bul2[] = "Ò";
        $degistir[] = "Ó";   $bul[] = "Ó";     $bul2[] = "Ó";
        $degistir[] = "Ô";   $bul[] = "Ô";     $bul2[] = "Ô";
        $degistir[] = "Õ";   $bul[] = "Õ";     $bul2[] = "Õ";
        $degistir[] = "Ö";   $bul[] = "Ö";     $bul2[] = "Ö";
        $degistir[] = "Ø";   $bul[] = "Ø";     $bul2[] = "Ø";
        $degistir[] = "Ù";   $bul[] = "Ù";     $bul2[] = "Ù";
        $degistir[] = "Ú";   $bul[] = "Ú";     $bul2[] = "Ú";
        $degistir[] = "Û";   $bul[] = "Û";     $bul2[] = "Û";
        $degistir[] = "Ü";   $bul[] = "Ü";     $bul2[] = "Ü";
        $degistir[] = "ß";   $bul[] = "ß";     $bul2[] = "ß";
        $degistir[] = "à";   $bul[] = "à";     $bul2[] = "à";
        $degistir[] = "á";   $bul[] = "á";     $bul2[] = "á";
        $degistir[] = "â";   $bul[] = "â";     $bul2[] = "â";
        $degistir[] = "ã";   $bul[] = "ã";     $bul2[] = "ã";
        $degistir[] = "ä";   $bul[] = "ä";     $bul2[] = "ä";
        $degistir[] = "å";   $bul[] = "å";     $bul2[] = "å";
        $degistir[] = "æ";   $bul[] = "æ";     $bul2[] = "æ";
        $degistir[] = "ç";   $bul[] = "ç";     $bul2[] = "ç";
        $degistir[] = "è";   $bul[] = "è";     $bul2[] = "è";
        $degistir[] = "é";   $bul[] = "é";     $bul2[] = "é";
        $degistir[] = "ê";   $bul[] = "ê";     $bul2[] = "ê";
        $degistir[] = "ë";   $bul[] = "ë";     $bul2[] = "ë";
        $degistir[] = "ì";   $bul[] = "ì";     $bul2[] = "ì";
        $degistir[] = "í";   $bul[] = "í";     $bul2[] = "í";
        $degistir[] = "î";   $bul[] = "î";     $bul2[] = "î";
        $degistir[] = "ï";   $bul[] = "ï";     $bul2[] = "ï";
        $degistir[] = "ñ";   $bul[] = "ñ";     $bul2[] = "ñ";
        $degistir[] = "ò";   $bul[] = "ò";     $bul2[] = "ò";
        $degistir[] = "ó";   $bul[] = "ó";     $bul2[] = "ó";
        $degistir[] = "ô";   $bul[] = "ô";     $bul2[] = "ô";
        $degistir[] = "õ";   $bul[] = "õ";     $bul2[] = "õ";
        $degistir[] = "ö";   $bul[] = "ö";     $bul2[] = "ö";
        $degistir[] = "ø";   $bul[] = "ø";     $bul2[] = "ø";
        $degistir[] = "ù";   $bul[] = "ù";     $bul2[] = "ù";
        $degistir[] = "ú";   $bul[] = "ú";     $bul2[] = "ú";
        $degistir[] = "û";   $bul[] = "û";     $bul2[] = "û";
        $degistir[] = "ü";   $bul[] = "ü";     $bul2[] = "ü";
        $degistir[] = "ÿ";   $bul[] = "ÿ";     $bul2[] = "ÿ";
        $degistir[] = '"';   $bul[] = "”";     $bul2[] = "”";
        $degistir[] = "
<br>";   $bul[] = "\n";
        $degistir[] = "
<br>";   $bul[] = "\r";
        $degistir[] = "
<br>";   $bul[] = "\r\n";
        $degistir[] = "
<br>";   $bul[] = "
        ";

        $cikti str_replace($bul$degistir$gelen);
        $cikti str_replace($bul2$degistir$cikti);

        return trim($cikti);
    }
    
    
    // E-POSTA BAŞLIKLARI OKUNUYOR
    Public function EpostaBaslik($sabit=0,$ilk=0,$son=10)
    {
        $EpostaBaslik imap_headers($this->Baglanti);
        // $EpostaBaslik = imap_sort($this->Baglanti, SORTARRIVAL, 1, SE_NOPREFETCH);
        $EpostaBaslik imap_sort($this->BaglantiSORTDATE1);
        $EpostaBaslikSayi $this->ToplamMail();
        $okunmus=0;
        $EpostaBaslikListe = array();
        
            
            foreach ($EpostaBaslik as $id => $icerik
            {
            
                if($sabit <= $id)
                {
                    if($ilk $son)
                    {
                        $header = (imap_headerinfo($this->Baglanti$icerik8080));
                        if($header->Unseen == 'U'$okunmus '1';
                        else $okunmus '0';
                        
                        
                        // DÖNÜŞTÜRME YAPILIYOR
                        $dnm[] = $header;
                        
                        $EpostaBaslikListe[$icerik]['no'] = $icerik;
                        
                        $EpostaBaslikListe[$icerik]['okunma'] = $okunmus;
                        
                        $EpostaBaslikListe[$icerik]['tarih'] = MailTarih('+2'strtotime((!empty($header->Date) ? $header->Date : ((!empty($header->date) ? $header->date: (!empty($header->MailDate) ? $header->MailDate ''))))));
                        
                        $EpostaBaslikListe[$icerik]['baslik'] = (!empty($header->Subject) ? $this->decodeMimeStr($header->Subject) : (!empty($header->subject) ? $this->decodeMimeStr($header->subject) : (!empty($header->fetchsubject) ? $this->decodeMimeStr($header->fetchsubject) : 'Konu belirtilmemiş')));
                    }
                    $ilk++;
                }
        }
        
        return $EpostaBaslikListe;    
        
    }

    
    // E-POSTA BAŞLIKLARI OKUNUYOR
    public function EpostaBaslikOku($Id)
    {
        try{
            $header=imap_header($this->Baglanti$Id80,80);

            $NTGMail["personal"] = (@$header->from[0]->personal $this->TakCevirici($this->decodeMimeStr(@$header->from[0]->personal)) : 'Personal bilgisi alınamadı');
            $NTGMail["fromaddress"] = (@$header->fromaddress $this->TakCevirici($this->decodeMimeStr(@$header->fromaddress)) : 'Fromaddress bilgisi alınamadı');
            $NTGMail["fetchfrom"] = (@$header->fetchfrom $this->TakCevirici($this->decodeMimeStr(@$header->fetchfrom)) : 'Fetchfrom bilgisi alınamadı');
            $NTGMail["senderaddress"] = (@$header->senderaddress $this->TakCevirici($this->decodeMimeStr(@$header->senderaddress)) : 'Senderaddress bilgisi alınamadı');
            $NTGMail["reply_toaddress"] = (@$header->reply_toaddress $this->TakCevirici($this->decodeMimeStr(@$header->reply_toaddress)) : 'Reply To Address bilgisi alınamadı');
            $NTGMail["reply_to_personal"] = (@$header->reply_to[0]->personal $this->TakCevirici($this->decodeMimeStr(@$header->reply_to[0]->personal)) : 'Reply To Personel bilgisi alınamadı');
            $NTGMail["Recent"] = (@$header->Recent ? @$header->Recent '');
            $NTGMail["Unseen"] = (@$header->Unseen ? @$header->Unseen '');
            $NTGMail["Flagged"] = (@$header->Flagged ? @$header->Flagged '');
            $NTGMail["Answered"] = (@$header->Answered ? @$header->Answered '');
            $NTGMail["Deleted"] = (@$header->Deleted ? @$header->Deleted '');
            $NTGMail["Draft"] = (@$header->Draft ? @$header->Draft '');
            $NTGMail["Msgno"] = (@$header->Msgno ? @$header->Msgno 'Mesaj no alınamadı');
            $NTGMail["Size"] = (@$header->Size ? @$header->Size 'E-Posta boyutu alınamadı');
            $NTGMail["to_mailbox_host"] = (@$header->to[0]->mailbox ? @$header->to[0]->mailbox."@"[email protected]$header->to[0]->host 'Adres alınamadı');
            $NTGMail["toaddress"] = (@$header->toaddress ? @$header->toaddress 'Adres alınamadı');
            $NTGMail["from_mailbox_host"] = (@$header->from[0]->mailbox ? @$header->from[0]->mailbox."@"[email protected]$header->from[0]->host 'Gönderen bilgisi yok');
            $NTGMail["sender_mailbox_host"] = (@$header->sender[0]->mailbox ? @$header->sender[0]->mailbox."@"[email protected]$header->sender[0]->host 'Gönderen bilgisi yok');
            $NTGMail["reply_to_mailbox_host"] = (@$header->reply_to[0]->mailbox ? @$header->reply_to[0]->mailbox."@"[email protected]$header->reply_to[0]->host 'Yanıt adresi yok');
            $NTGMail["fetchsubject"] = (@$header->fetchsubject $this->decodeMimeStr(@$header->fetchsubject) : 'Konu belirtilmemiş');
            $NTGMail["subject"] = (@$header->subject $this->decodeMimeStr(@$header->subject) : 'Konu belirtilmemiş');
            $NTGMail["Subject"] = (@$header->Subject $this->decodeMimeStr(@$header->Subject) : 'Konu belirtilmemiş');
            $NTGMail["message_id"] = (@$header->message_id ? @$header->message_id 'Mesaj ID bulunamadı');
            $NTGMail["date"] = (@$header->date ? @$header->date 'Tarih belirsiz');
            $NTGMail["Date"] = (@$header->Date ? @$header->Date 'Tarih belirsiz');
            $NTGMail["MailDate"] = (@$header->MailDate ? @$header->MailDate 'Tarih belirsiz');
            $NTGMail["udate"] = Date("F j, Y, g:i a", @$header->udate);

            // BAĞLANTI YAPILAMAZSA EKRANA BİLGİ YAZDIRILIYOR
            if(!$header){
                throw new Exception ("<table style='padding: 2px; border: 1px solid darkred; background-color: #ffd0d0; font-family: Verdana; font-size: 10px;' align='center'><tr><td><b>HEADER Okunamadı:</b>
<br><center>".imap_last_error()."</center></td></tr></table>");
            }

            return $NTGMail;
        }    
        // BAĞLANTI YAPILAMAZSA EKRANA BİLGİ YAZDIRILIYOR
        catch (Exception $Hata){
            die($Hata->getMessage());
            exit();
        }
    }
    

    // DİZİ DEĞİŞKENLER TARANIP ANLAŞILIR HALE GETİRİLİYOR
    public function DiziDegiskenAra($array$key){
            if(is_object($array))
                $array = (array)$array;
           
            // search for the key
            $result = array();
            foreach ($array as $k => $value) {
                if(is_array($value) || is_object($value)){
                    $r $this->DiziDegiskenAra($value$key);
                    if(!is_null($r))
                        array_push($result,$r);
                }
            }
           
            if(array_key_exists($key$array))
                array_push($result,$array[$key]);
           
           
            if(count($result) > 0){
                // resolve nested arrays
                $result_plain = array();
                foreach ($result as $k => $value) {
                    if(is_array($value))
                        $result_plain array_merge($result_plain,$value);
                    else
                        array_push($result_plain,$value);
                }
                return $result_plain;
            }
            return NULL;
        }
    
    
    // RESIMLER AYIKLANIYOR
    public function cidDonustur($veri) {
        return preg_match_all('/=["\'](ci?d:(.*?))["\']/i'$veri$sonuc) ? array_combine($sonuc[2], $sonuc[1]) : array();
    }
    
    
    // E-POSTA GÖVDESİ OKUNUYOR
    Public function EpostaGovde($gelenId)
    {
        $Veriler $this->TumVeriler($gelenId);
            
        $html $this->DiziDegiskenAra($Veriler"html");
        $rfc822 $this->DiziDegiskenAra($Veriler"rfc822");
        $plain $this->DiziDegiskenAra($Veriler"plain");
        $alternative $this->DiziDegiskenAra($Veriler"alternative");
        $resim $this->DiziDegiskenAra($Veriler"resim");
        $dosya $this->DiziDegiskenAra($Veriler"dosya");
        $text $this->DiziDegiskenAra($Veriler"text");
        
        $EpostaGovdeSayi $this->ToplamMail();
        $VerilerDosya='';
            
                
        // E-POSTA GÖVDESİ VARSA OKUNUYOR
        if( $EpostaGovdeSayi 
        {
            
            $EpostaGovdeAktar="";
            
            if(isset($html))
            {
                // DÖNÜŞTÜRME YAPILIYOR
                if((!empty($html['kodlama'])) and ($html['kodlama'] != 'UTF-8')) {
                    $html['icerik'] = iconv($html['kodlama'], "UTF-8//TRANSLIT//IGNORE"$html['icerik']);
                }
                $EpostaGovdeAktar .= $html['icerik'];
            }
            else if(isset($text))
            {
                // DÖNÜŞTÜRME YAPILIYOR
                if((!empty($text['kodlama'])) and ($text['kodlama'] != 'UTF-8')) {
                    $text['icerik'] = iconv($text['kodlama'], "UTF-8//TRANSLIT//IGNORE"$text['icerik']);
                }
                $EpostaGovdeAktar .= '<div>'.$text['icerik'].'</div>';
            }
            else if(isset($plain))
            {
                // DÖNÜŞTÜRME YAPILIYOR
                if((!empty($plain['kodlama'])) and ($plain['kodlama'] != 'UTF-8')) {
                    $plain['icerik'] = iconv($plain['kodlama'], "UTF-8//TRANSLIT//IGNORE"$plain['icerik']);
                }
                
                
                // PLAİN PARÇALARA BÖLÜNÜYOR
                $aktarimArrayPlain explode("\n\r",$plain['icerik']);
                $aktarimArrayPlainSon = array();
                
                
                $plain_resimno='';
                
                
                // DİZİ DÖNDÜRÜLÜYOR
                for($i=0$i count($aktarimArrayPlain); $i++)
                {
                    if(preg_match('/base64/',$aktarimArrayPlain[$i])) $plain_resimno = ($i+1);
                    // İÇİNDE RESİM OLMAYAN VE -- İLE BAŞLAMAYAN SATIRLAR ALINIYOR
                    if(($i) != $plain_resimno)
                    {
                        if(!preg_match('/--/',$aktarimArrayPlain[$i])) {
                            $aktarimArrayPlain[$i] = preg_replace('|\-\-(.*?)\-\-|si','',$aktarimArrayPlain[$i]);
                          $aktarimArrayPlainSon[] = $aktarimArrayPlain[$i];
                        }                    
                    }                    
                }
                
                
                // RESİM ALINIYOR
                if($plain_resimno != '') {
                    $aktarimArrayPlain[$plain_resimno] = preg_replace('|\-\-(.*?)\-\-|si','',$aktarimArrayPlain[$plain_resimno]);
                  $Plain_resim '<img src="data:image/png;base64,'.$aktarimArrayPlain[$plain_resimno].'">';
                }    
                
                
                
                // EKRAN ÇIKTISI HAZIRLANIYOR
                $tamamla '<div class="bls_class_tamamla"><div>';
                $PlainTemizle $aktarimArrayPlainSon;
                for($i=0$i count($PlainTemizle); $i++)
                {
                    // RESİM VE BAŞLIK OLMAYAN YAZILAR ALT ALTA EKLENİYOR
                    if((!preg_match('/Received:/',$PlainTemizle[$i])) and (!preg_match('/\<\/html\>/',$PlainTemizle[$i]))) {
                          
                          $tamamla .= '
<p>'.$PlainTemizle[$i].'</p>';
                    }    
                }    
                                    
                
                $tamamla .= '</div>';
                
                // RESİM EKLENİYOR
                if((isset($Plain_resim)) and ($Plain_resim != ''))
                $tamamla .= '<div class="bls_class_tamamla_devam">'.$Plain_resim.'</div>';
                
                $EpostaGovdeAktar .= $tamamla;
                
            }
            else if(isset($alternative))
            {
                // DÖNÜŞTÜRME YAPILIYOR
                if((!empty($alternative['kodlama'])) and ($alternative['kodlama'] != 'UTF-8')) {
                    $alternative['icerik'] = iconv($alternative['kodlama'], "UTF-8//TRANSLIT//IGNORE"$alternative['icerik']);
                }
                $EpostaGovdeAktar .= '<div>'.$alternative['icerik'].'</div>';
            }
            
            if(isset($rfc822))
            {
                // DÖNÜŞTÜRME YAPILIYOR
                if((!empty($rfc822['kodlama'])) and ($rfc822['kodlama'] != 'UTF-8')) {
                    $rfc822['icerik'] = iconv($rfc822['kodlama'], "UTF-8//TRANSLIT//IGNORE"$rfc822['icerik']);
                }
                
                // MULTİPART RFC822 MAİL PARÇALARA BÖLÜNÜYOR
                $aktarimArray explode("\n\r",$rfc822['icerik']);
                $aktarimArrayRFC822Son = array();
                
                $RFC822_resimno='';
                
                
                // DİZİ DÖNDÜRÜLÜYOR
                for($i=0$i count($aktarimArray); $i++)
                {
                    if(preg_match('/base64/',$aktarimArray[$i])) $RFC822_resimno = ($i+1);
                    // İÇİNDE RESİM OLMAYAN VE -- İLE BAŞLAMAYAN SATIRLAR ALINIYOR
                    if(($i) != $RFC822_resimno)
                    {
                        if(!preg_match('/--/',$aktarimArray[$i])) {
                            $aktarimArray[$i] = preg_replace('|\-\-(.*?)\-\-|si','',$aktarimArray[$i]);
                          $aktarimArrayRFC822Son[] = $aktarimArray[$i];
                        }                    
                    }                    
                }
                
                
                // RESİM ALINIYOR                
                if($RFC822_resimno != '') {
                    $aktarimArray[$RFC822_resimno] = preg_replace('|\-\-(.*?)\-\-|si','',$aktarimArray[$RFC822_resimno]);
                  $RFC822_resim '<img src="data:image/png;base64,'.$aktarimArray[$RFC822_resimno].'">';
                }                    
                
                // EKRAN ÇIKTISI HAZIRLANIYOR
                $tamamla '';
                
                // RESİM EKLENİYOR
                if((isset($RFC822_resim)) and ($RFC822_resim != ''))
                $tamamla .= '<div class="bls_class_tamamla_devam">'.$RFC822_resim.'</div>';
                
                
                $tamamla .= '<div class="bls_class_tamamla">';
                $RFC822Temizle $aktarimArrayRFC822Son;
                for($i=0$i count($RFC822Temizle); $i++)
                {
                    // RESİM VE BAŞLIK OLMAYAN YAZILAR ALT ALTA EKLENİYOR
                    if((!preg_match('/Received:/',$RFC822Temizle[$i])) and (!preg_match('/\<\/html\>/',$RFC822Temizle[$i]))) {
                          
                          $tamamla .= '
<p>'.$RFC822Temizle[$i].'</p>';
                    }    
                }    
                                    
                
                $tamamla .= '</div>';
                
                $EpostaGovdeAktar .= $tamamla;
                
            }
            
            $EpostaGovdeAktar str_replace('<div class="bls_class_tamamla_devam"></div>','',$EpostaGovdeAktar);
            
            
            // HTML E-POSTA İÇERİSİNDEKİ RESİM BULUNUP DÜZELTİLİYOR
            if(isset($resim))
            {
                
                $cidCikti $this->cidDonustur($EpostaGovdeAktar);
                
                foreach($resim as $format => $deger){        
                    foreach($deger as $cid => $isim){
                        // $EpostaGovdeAktar = @str_replace($cidCikti[$cid], 'data:image/'.$format.';base64,'.$isim, $EpostaGovdeAktar);
                        $EpostaGovdeAktar = @str_replace($cidCikti[$cid], $isim$EpostaGovdeAktar);
                    }
                }
            }
            
            // DOSYA AKTARIMI
            if(isset($dosya))
            {
                    $VerilerDosya $dosya;
                    
            }
            

            // RESİM İSİMLERİ NETLEŞTİRİLİYOR
            
                
            // FONKSİYON SONLANDIRILIP DİZİ DEĞİŞKEN HALİNE GETİRİLİYOR
            return array('EpostaGovdeSayi' => $EpostaGovdeSayi'EpostaGovde' => $EpostaGovdeAktar'EpostaDosyalar' => $VerilerDosya);
        }
         else return false;
         
    }
    // E-POSTA GÖVDESİ OKUNUYOR
    

    // IMAP DECODE 7BİT
    public function decode7Bit($text)
    {
        $lines explode("\r\n"$text);
        $first_line_words explode(' '$lines[0]);
        if ($first_line_words[0] == $lines[0]) {
          $text base64_decode($text);
        }

        $characters = array(
          '=20' => ' '// space.
          '=2C' => ','// comma.
          '=E2=80=99' => "'"// single quote.
          '=0A' => "\r\n"// line break.
          '=0D' => "\r\n"// carriage return.
          '=A0' => ' '// non-breaking space.
          '=B9' => '$sup1'// 1 superscript.
          '=C2=A0' => ' '// non-breaking space.
          "=\r\n" => ''// joined line.
          '=E2=80=A6' => '…'// ellipsis.
          '=E2=80=A2' => '•'// bullet.
          '=E2=80=93' => '–'// en dash.
          '=E2=80=94' => '—'// em dash.
        );

        foreach ($characters as $key => $value) {
          $text str_replace($key$value$text);
        }

        return $text;
    }
    
    
    // VERİLER AYIKLANIYOR
    // RESİM VE DİĞER BİLGİLER ÇEKİLİYOR
    public function TumVeriler($mid)
    {
        // VERİ PARTLARA BÖLÜNÜYOR
        function TumPartlar($Baglanti,$uid)
        {
             global $mime,$AnaDizi,$enc;
              $mime = array("text","multipart","message","application","audio",
            "image","video","other","unknow");
                

             $struct imap_fetchstructure($Baglanti,$uidFT_UID);

             $AnaDizi = array();

            function scan($struct,$subkey){
             global $mime,$enc,$AnaDizi;
             
               foreach($struct as $key => $value){

             
                if($subkey!=0){
                $pid $subkey.".".($key+1); }
                else { $pid = ($key+1); }
             
                $AnaDizi[]['part'] = $pid;
                $AnaDizi[key($AnaDizi)]['type'] = $mime["$value->type"];
                $AnaDizi[key($AnaDizi)]['tip'] = $value->encoding;
                
                if(isset($value->id)) $AnaDizi[key($AnaDizi)]['id'] = $value->id;
                else $AnaDizi[key($AnaDizi)]['id'] = "";
                
                $AnaDizi[key($AnaDizi)]['ifid'] = $value->ifid;
                
                if(array_key_exists('0'$value->parameters)) $AnaDizi[key($AnaDizi)]['adi'] = $value->parameters[0]->value;
                else $AnaDizi[key($AnaDizi)]['adi'] = "";
                
                $AnaDizi[key($AnaDizi)]['cesit'] = strtolower($value->subtype);

                if(array_key_exists('0'$value->parameters) and (strtolower($value->parameters[0]->attribute) == 'charset')) 
                    $AnaDizi[key($AnaDizi)]['kodlama'] = strtolower($value->parameters[0]->value);
                else $AnaDizi[key($AnaDizi)]['kodlama'] = "";
                    
                next($AnaDizi);
             
                if(((isset($value->parts)) and ($value->parts)!= null)) {scan($value->parts,$pid); }
               }
             }

            if(isset($struct->parts))
            {
                if(!is_null($struct->parts))
                {
                 scan($struct->parts,0);
                }
            }
            else
            {
                $AnaDizi[]['part'] = "partyok";
                $AnaDizi[key($AnaDizi)]['type'] = $mime["$struct->type"];
                $AnaDizi[key($AnaDizi)]['tip'] = $struct->encoding;
                
                if(isset($struct->id)) $AnaDizi[key($AnaDizi)]['id'] = $struct->id;
                else $AnaDizi[key($AnaDizi)]['id'] = "";
                
                $AnaDizi[key($AnaDizi)]['ifid'] = $struct->ifid;
                $AnaDizi[key($AnaDizi)]['adi'] = $struct->parameters[0]->value;
                $AnaDizi[key($AnaDizi)]['cesit'] = strtolower($struct->subtype);

                if(strtolower($struct->parameters[0]->attribute) == 'charset'
                    $AnaDizi[key($AnaDizi)]['kodlama'] = strtolower($struct->parameters[0]->value);
                else $AnaDizi[key($AnaDizi)]['kodlama'] = "";

            }
            

            
        return $AnaDizi;
        }


        $Kullanici explode('@',self::$Kullanici);
        $AnaDizi TumPartlar($this->Baglanti,$mid);

        $isim = array();
        
        // GELEN VERİLER AYIKLANIYOR
        foreach($AnaDizi as $anahtar => $deger)
        {
            // if (($deger['tip'] == 3) and ($deger['ifid'] == 0)) $veri="";
            // else
            // {
                if($deger['part'] == 'partyok'$veri imap_body($this->Baglanti$midFT_UID);
                else $veri imap_fetchbody($this->Baglanti,$mid,$deger['part'],FT_UID);
            // }

            if ($deger['tip'] == 0)
                $veri quoted_printable_decode(imap_8bit($veri));
            if ($deger['tip'] == 1)
                $veri quoted_printable_decode(imap_8bit ($veri));
            if ($deger['tip'] == 2)
                $veri imap_binary($veri);
            if ($deger['tip'] == 3)
                $veri imap_base64($veri); 
            if ($deger['tip'] == 4)
                $veri quoted_printable_decode(imap_qprint($veri));
            if ($deger['tip'] == 5)
                $veri $veri;
                
                
            if($veri != ''
            {
                $isim[$deger['cesit']]['icerik'] = $veri;
                $isim[$deger['cesit']]['kodlama'] = $deger['kodlama'];
            }
            
            if($deger['tip'] == 3)
            {
                if($deger['ifid'] == 1)
                {
                    $rsmId $deger['ifid'] ? trim($deger['id'], " <>") : (isset($deger['adi']) ? mt_rand() . mt_rand() : null);
                    
                    if(strtolower($deger['cesit']) != 'zip')
                    {
                        // DOSYA ADI BELİRLENİYOR
                        $dosyaadi = ("bylegens_".$Kullanici[0]."_".$mid."_".substr(md5($deger['adi'].$deger['cesit'].$rsmId),0,20)."_.".strtolower($deger['cesit']));
                        // DOSYA YAZILIYOR
                        $fp=fopen("./resimler/".$dosyaadi,"w");
                        fwrite($fp,$veri);
                        fclose($fp);
                        // İSİM DİZİ DEĞİŞKENE AKTARILIYOR
                        
                        // $isim['resim'][strtolower($deger['cesit'])][$rsmId] = base64_encode($veri); // BASE64 RESİM Görüntüleme
                        $isim['resim'][strtolower($deger['cesit'])][$rsmId] ="./resimler/$dosyaadi";
                    }
                }
                else
                {
                    $adi BLSEPOSTA::decodeMimeStr($deger['adi']);
                    $adi BLSEPOSTA::decodeRFC2231($deger['adi']);
                    
                        $replace = array(
                            '/\s/' => '_',
                            '/[^0-9a-zA-Z_\.]/' => '',
                            '/_+/' => '_',
                            '/(^_)|(_$)/' => '',
                        );
                        
                        // DOSYA ADI BELİRLENİYOR
                        if(strtolower($deger['type']) != 'text')
                        {
                            if(strtolower($deger['cesit']) == 'zip')
                            $dosyaadi preg_replace('~[\\\\/]~''', ("bylegens_".$Kullanici[0]."_".$mid."_".substr(md5($adi.$deger['cesit'].$mid),0,20)."_".preg_replace(array_keys($replace), $replace$adi).".zip"));
                            else 
                            $dosyaadi preg_replace('~[\\\\/]~''', ("bylegens_".$Kullanici[0]."_".$mid."_".substr(md5($adi.$deger['cesit'].$mid),0,20)."_".preg_replace(array_keys($replace), $replace$adi)));
                            // DOSYA YAZILIYOR
                            // $fp=fopen("./dosyalar/".$dosyaadi,"w");
                            // fwrite($fp,$veri);
                            // fclose($fp);
                            // İSİM DİZİ DEĞİŞKENE AKTARILIYOR
                            if(isset($deger['part'])) $partno $deger['part'];
                            else $partno "";
                            
                            $isim['dosya'][strtolower($deger['cesit'])][$dosyaadi] = $partno;
                            // $isim['dosya'][] = $dosyaadi;
                        }
                }
            }
        }
                    
        
        return $isim;

    }
    // RESİM VE DİĞER BİLGİLER ÇEKİLİYOR - SONU
    // VERİLER AYIKLANIYOR - SONU
    
    
    Public function sifrele($deger)
    {
        return @base64_encode($deger); 
    }
    
    Public function BaglantiKapat()
    {
        return @imap_close($this->Baglanti); 
    }
    
    
}


E-Posta Eklerini İndirmek İçin



Kod Çizelgesi:[Hepsini Seç] 
Class DOSYALAR Extends BLSEPOSTA
{
    public function DosyaIndir($uid,$part,$mime_turu,$dosya_adi)
    {
        $veri imap_fetchbody($this->Baglanti,$uid,$part,FT_UID);
            
        $veri imap_base64($veri); 
            
        switch( $mime_turu)
        {
            case "isp"$mime_tipi="application/x-internet-signup"; break;
            case "crd"$mime_tipi="application/x-mscardfile"; break;
            case "pmc"$mime_tipi="application/x-perfmon"; break;
            case "spc"$mime_tipi="application/x-pkcs7-certificates"; break;
            case "sv4crc"$mime_tipi="application/x-sv4crc"; break;
            case "bin"$mime_tipi="application/octet-stream"; break;
            case "clp"$mime_tipi="application/x-msclip"; break;
            case "mny"$mime_tipi="application/x-msmoney"; break;
            case "p7r"$mime_tipi="application/x-pkcs7-certreqresp"; break;
            case "evy"$mime_tipi="application/envoy"; break;
            case "p7s"$mime_tipi="application/pkcs7-signature"; break;
            case "eps"$mime_tipi="application/postscript"; break;
            case "setreg"$mime_tipi="application/set-registration-initiation"; break;
            case "xlm"$mime_tipi="application/vnd.ms-excel"; break;
            case "cpio"$mime_tipi="application/x-cpio"; break;
            case "dvi"$mime_tipi="application/x-dvi"; break;
            case "p7b"$mime_tipi="application/x-pkcs7-certificates"; break;
            case "doc"$mime_tipi="application/msword"; break;
            case "dot"$mime_tipi="application/msword"; break;
            case "p7c"$mime_tipi="application/pkcs7-mime"; break;
            case "ps"$mime_tipi="application/postscript"; break;
            case "wps"$mime_tipi="application/vnd.ms-works"; break;
            case "csh"$mime_tipi="application/x-csh"; break;
            case "iii"$mime_tipi="application/x-iphone"; break;
            case "pmw"$mime_tipi="application/x-perfmon"; break;
            case "man"$mime_tipi="application/x-troff-man"; break;
            case "hdf"$mime_tipi="application/x-hdf"; break;
            case "mvb"$mime_tipi="application/x-msmediaview"; break;
            case "texi"$mime_tipi="application/x-texinfo"; break;
            case "setpay"$mime_tipi="application/set-payment-initiation"; break;
            case "stl"$mime_tipi="application/vndms-pkistl"; break;
            case "mdb"$mime_tipi="application/x-msaccess"; break;
            case "oda"$mime_tipi="application/oda"; break;
            case "hlp"$mime_tipi="application/winhlp"; break;
            case "nc"$mime_tipi="application/x-netcdf"; break;
            case "sh"$mime_tipi="application/x-sh"; break;
            case "shar"$mime_tipi="application/x-shar"; break;
            case "tcl"$mime_tipi="application/x-tcl"; break;
            case "ms"$mime_tipi="application/x-troff-ms"; break;
            case "ods"$mime_tipi="application/oleobject"; break;
            case "axs"$mime_tipi="application/olescript"; break;
            case "xla"$mime_tipi="application/vnd.ms-excel"; break;
            case "mpp"$mime_tipi="application/vnd.ms-project"; break;
            case "dir"$mime_tipi="application/x-director"; break;
            case "sit"$mime_tipi="application/x-stuffit"; break;
            case "*"$mime_tipi="application/octet-stream"; break;
            case "crl"$mime_tipi="application/pkix-crl"; break;
            case "ai"$mime_tipi="application/postscript"; break;
            case "xls"$mime_tipi="application/vnd.ms-excel"; break;
            case "wks"$mime_tipi="application/vnd.ms-works"; break;
            case "ins"$mime_tipi="application/x-internet-signup"; break;
            case "pub"$mime_tipi="application/x-mspublisher"; break;
            case "wri"$mime_tipi="application/x-mswrite"; break;
            case "spl"$mime_tipi="application/futuresplash"; break;
            case "hqx"$mime_tipi="application/mac-binhex40"; break;
            case "p10"$mime_tipi="application/pkcs10"; break;
            case "xlc"$mime_tipi="application/vnd.ms-excel"; break;
            case "xlt"$mime_tipi="application/vnd.ms-excel"; break;
            case "dxr"$mime_tipi="application/x-director"; break;
            case "js"$mime_tipi="application/x-javascript"; break;
            case "m13"$mime_tipi="application/x-msmediaview"; break;
            case "trm"$mime_tipi="application/x-msterminal"; break;
            case "pml"$mime_tipi="application/x-perfmon"; break;
            case "me"$mime_tipi="application/x-troff-me"; break;
            case "wcm"$mime_tipi="application/vnd.ms-works"; break;
            case "latex"$mime_tipi="application/x-latex"; break;
            case "m14"$mime_tipi="application/x-msmediaview"; break;
            case "wmf"$mime_tipi="application/x-msmetafile"; break;
            case "cer"$mime_tipi="application/x-x509-ca-cert"; break;
            case "zip"$mime_tipi="application/x-zip-compressed"; break;
            case "p12"$mime_tipi="application/x-pkcs12"; break;
            case "pfx"$mime_tipi="application/x-pkcs12"; break;
            case "der"$mime_tipi="application/x-x509-ca-cert"; break;
            case "pdf"$mime_tipi="application/pdf"; break;
            case "xlw"$mime_tipi="application/vnd.ms-excel"; break;
            case "texinfo"$mime_tipi="application/x-texinfo"; break;
            case "p7m"$mime_tipi="application/pkcs7-mime"; break;
            case "pps"$mime_tipi="application/vnd.ms-powerpoint"; break;
            case "dcr"$mime_tipi="application/x-director"; break;
            case "gtar"$mime_tipi="application/x-gtar"; break;
            case "sct"$mime_tipi="text/scriptlet"; break;
            case "fif"$mime_tipi="application/fractals"; break;
            case "exe"$mime_tipi="application/octet-stream"; break;
            case "ppt"$mime_tipi="application/vnd.ms-powerpoint"; break;
            case "sst"$mime_tipi="application/vndms-pkicertstore"; break;
            case "pko"$mime_tipi="application/vndms-pkipko"; break;
            case "scd"$mime_tipi="application/x-msschedule"; break;
            case "tar"$mime_tipi="application/x-tar"; break;
            case "roff"$mime_tipi="application/x-troff"; break;
            case "t"$mime_tipi="application/x-troff"; break;
            case "prf"$mime_tipi="application/pics-rules"; break;
            case "rtf"$mime_tipi="application/rtf"; break;
            case "pot"$mime_tipi="application/vnd.ms-powerpoint"; break;
            case "wdb"$mime_tipi="application/vnd.ms-works"; break;
            case "bcpio"$mime_tipi="application/x-bcpio"; break;
            case "dll"$mime_tipi="application/x-msdownload"; break;
            case "pma"$mime_tipi="application/x-perfmon"; break;
            case "pmr"$mime_tipi="application/x-perfmon"; break;
            case "tr"$mime_tipi="application/x-troff"; break;
            case "src"$mime_tipi="application/x-wais-source"; break;
            case "acx"$mime_tipi="application/internet-property-stream"; break;
            case "cat"$mime_tipi="application/vndms-pkiseccat"; break;
            case "cdf"$mime_tipi="application/x-cdf"; break;
            case "tgz"$mime_tipi="application/x-compressed"; break;
            case "sv4cpio"$mime_tipi="application/x-sv4cpio"; break;
            case "tex"$mime_tipi="application/x-tex"; break;
            case "ustar"$mime_tipi="application/x-ustar"; break;
            case "crt"$mime_tipi="application/x-x509-ca-cert"; break;
            case "ra"$mime_tipi="audio/x-pn-realaudio"; break;
            case "mid"$mime_tipi="audio/mid"; break;
            case "au"$mime_tipi="audio/basic"; break;
            case "snd"$mime_tipi="audio/basic"; break;
            case "wav"$mime_tipi="audio/wav"; break;
            case "aifc"$mime_tipi="audio/aiff"; break;
            case "m3u"$mime_tipi="audio/x-mpegurl"; break;
            case "ram"$mime_tipi="audio/x-pn-realaudio"; break;
            case "aiff"$mime_tipi="audio/aiff"; break;
            case "rmi"$mime_tipi="audio/mid"; break;
            case "aif"$mime_tipi="audio/x-aiff"; break;
            case "mp3"$mime_tipi="audio/mpeg"; break;
            case "gz"$mime_tipi="application/x-gzip"; break;
            case "z"$mime_tipi="application/x-compress"; break;
            case "tsv"$mime_tipi="text/tab-separated-values"; break;
            case "xml"$mime_tipi="text/xml"; break;
            case "323"$mime_tipi="text/h323"; break;
            case "htt"$mime_tipi="text/webviewhtml"; break;
            case "stm"$mime_tipi="text/html"; break;
            case "html"$mime_tipi="text/html"; break;
            case "xsl"$mime_tipi="text/xml"; break;
            case "htm"$mime_tipi="text/html"; break;
            case "cod"$mime_tipi="image/cis-cod"; break;
            case "ief"$mime_tipi="image/ief"; break;
            case "pbm"$mime_tipi="image/x-portable-bitmap"; break;
            case "tiff"$mime_tipi="image/tiff"; break;
            case "ppm"$mime_tipi="image/x-portable-pixmap"; break;
            case "rgb"$mime_tipi="image/x-rgb"; break;
            case "dib"$mime_tipi="image/bmp"; break;
            case "jpeg"$mime_tipi="image/jpeg"; break;
            case "cmx"$mime_tipi="image/x-cmx"; break;
            case "pnm"$mime_tipi="image/x-portable-anymap"; break;
            case "jpe"$mime_tipi="image/jpeg"; break;
            case "jfif"$mime_tipi="image/pjpeg"; break;
            case "tif"$mime_tipi="image/tiff"; break;
            case "jpg"$mime_tipi="image/jpeg"; break;
            case "xbm"$mime_tipi="image/x-xbitmap"; break;
            case "ras"$mime_tipi="image/x-cmu-raster"; break;
            case "gif"$mime_tipi="image/gif";
            case "php"$mime_tipi="text/php";
            case "html"$mime_tipi="text/html";
            case "asp"$mime_tipi="text/asp";
            case "css"$mime_tipi="text/css";
            default: $mime_tipi="application/force-download";
        }

         // Set headers
        header("Pragma: public"); // required
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Cache-Control: public"); // required for certain browsers
        header("Content-Description: File Transfer");
        header("Content-Type: $mime_tipi");
        header("Content-Disposition: attachment; filename=".$dosya_adi.";" );
        header("Content-Transfer-Encoding: binary");
        //header("Content-Length: ");
        
        echo $veri;
        exit();
    }
}


Kullanım Şekli



İlk olarak sınıf içerisinde yer alan host bilgilerini doğru bir şekilde girmeniz gerekiyor.

Kod Çizelgesi:[Hepsini Seç]
Public $Host '{mail.siteadi.com:993/imap/ssl/novalidate-cert}';


Daha sonra kullanıcı adı ve şifre alanlarını doğru bir şekilde doldurduktan sonra, e-postalar üzerinde id ve no ile işlem yapabilirsiniz.

Kod Çizelgesi:[Hepsini Seç]
BLSEPOSTA::AYAR("PKutusu""INBOX");
    // BLSEPOSTA::AYAR("Kullanici", "[email protected]");
    BLSEPOSTA::AYAR("Kullanici""info");
    BLSEPOSTA::AYAR("Sifre""123456789");

    $EPOSTA = new BLSEPOSTA();
    $MailBaslik $EPOSTA->EpostaBaslik();
    print_r($MailBaslik);

    $EPostaBilgileri $EPOSTA->EpostaBaslikOku($MailBaslik[0]['no']);
    print_r($EPostaBilgileri);

    $EpostaGovde $EPOSTA->EpostaGovde($EPOSTA->MailUid($MailBaslik[0]['no']));
    print_r($EpostaGovde);
Etiketler: , , , ,
Yorumlar  (Toplam: 0) Sıralama:
Henüz yorum yapılmamış, ilk yorumu siz yazın.
Yorum Yaz
Onay Kodu .
 
Yücel KAHRAMAN