Search code examples
phpcodeigniterimappop3

Codeigniter access emails with Image as attachments (pop3 imap)


I want to download to get the following information from my emails

sender
sender_email_address
subject
Message
attachments = array(
       all attachments
)

any library? suggestions? links?


Solution

  • Here is the library that can be used..

    http://garrettstjohn.com/entry/reading-emails-with-php/

    plus accessing the library, extracting email and its attachments

    http://garrettstjohn.com/entry/extracting-attachments-from-emails-with-php/

    Something that was missing in this extraction, was a function to process image, so I had to do it...

    function _process_img($attach, $ext){
    
        $directory = "uploads";
    
        $path=realpath(APPPATH."../".$directory);
        $file_name="any_name_you_want_to_give".".".$ext;
    
        $file=$directory.$file_name;
        if(file_put_contents($path."/".$file_name, $attach)) return $file;
    }
    

    Hope it will help someone else too...