Script to access IMAP and save all new attachments to DB

This project was awarded to GoldenBow for $60 USD.

Get free quotes for a project like this
Project Budget
$30 - $250 USD
Total Bids
Project Description

I'm trying to fill a MySQL database with the daily email reports I get from my ad networks. I want to put a script on my web server, set cron up to run it every day at a certain time, and have it add the newest report data from that email inbox to a MySQL database so I can use that information in a combined ad revenue report I'll make on my own.

I have set up a gmail account specifically for these ad reports. It only gets two emails a day, one from Six Apart Media and another from Technorati Media.

Each message has a specific sender and subject name that never changes. The email body content is useless "here is your report" stuff. One network sends a .txt file, the other sends a .html file. They are delivered every 24 hours.

So my thought is that I need a script that will log in to the Gmail account with IMAP, download all emails newer than the stored timestamp of the most recently downloaded email it read last time, and then write two rows to a database containing the contents of the .html or .xls attachment in those emails.

I imagine the database should have three columns: "filename", "network", and "attachmentcontents". Filename should be the name of the .txt or .html attachment (it includes the report date, so it's useful), network would be either "Six Apart" or "Technorati" (depending on the subject\sender) and the attachmentcontents should be the plaintext contents of the .txt or .html file attached in each respective message.

I have basic-intermediate PHP experience but none using the libraries to access IMAP, and I'd rather not learn it just so I can accomplish a super simple task that I am sure an expert could do pretty quickly :)

Awarded to:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online