Monday, December 20, 2010

PHP: Gmail Class

I have created a class for Gmail using PHP.This class allows file attachments to be automatically downloaded into your server file directory.
Currently, I am still writing the functions for sending mail.

Do take note that in order for the server to be able to access gmail, imap-ssl must be configured for your PHP. You can check whether imap-ssl is installed by running a PHP which contains phpinfo(). Under the 3rd column, Configure Command, you should be able to see: ' --with-imap-ssl'
If you do not see that, please reconfigure your PHP installation to include that.

You can download the PHP files for the class here and the class tester here.
Alternatively, you can visit my website here.

Here are some snapshot of the output and the codes.

Output:

When there is a same file in the directory in which the file is to be downloaded into.
The 2nd one shows a file being downloaded.



Here are some snapshots of the code...

















This is the PHP to test the Gmail Class



5 comments:

  1. Shoaib (vb.shoaib@gmail.com)January 10, 2011 at 8:28 PM

    Luks really Excellent !!! Are you giving this code to others (like opensource) ?

    ReplyDelete
  2. Hi Shoaib, u can download the code at my personal website: http://chernkuan.weebly.com/programming-projects.html

    ReplyDelete
  3. Have had a play with the code and it works great and think it is a great base for IMAP.
    I have worked through and updated it for my purpose as my system needs to save the messages to a database. I have found a couple of areas which you might want to consider in future releases.

    More than one part level so it works its way down through the parts of the message.
    Handling for cid: within images on the site.

    ReplyDelete
  4. We are getting garbled messages from google IMAP when it displays in our PHP do you feel this fix will correct

    ReplyDelete
  5. Hi, I will look into that in my future programs :)
    To Joe, I am not very sure how you program it =P Maybe u can check ur codes with someone?

    ReplyDelete