Google – Php Parsing Gmail IMAP Email

Want to know something pretty slick?!?! With PHP you can parse emails in your inbox. Why would you want to do this? You can easily turn email into a means of collecting data from your users and trigger different actions. Examples: 1) Create a support email account that parses all recieved emails and creates help tickets automatically 2) Create a text message distribution list. If there is ever a problem shoot an email to the specific account, upon receipt it texts that message to your team. 3) Update a blog or webpage. Capture all emails in an inbox and create blog posts or webpages out of them. 4) Setup an email parsing script that looks for keywords and sends back auto-generated responses.

That is awesome! How do I get started?

What you need:

  1. You need at least PHP 5
  2. You will need an IMAP email account. For this example I will be using a gmail account.You will need to enable IMAP in gmail.To enable IMAP in your gmail settings:Settings->Forwarding and POP/IMAP->Enable IMAP->Save Changes
  3. Open your php.ini file and ensure the extension php_imap.dll is enabled