SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Email to CRM Application Design Question

    So I am building an application to integrate email into a custom CRM with php/mysql and am wondering what approach to take. I have two options. The first does everything on one process. The second splits it in 2 seperate processes or services.

    I am thinking of either
    OPTION I
    A single service that parses email contents directly into the live database.
    1. reading the email.
    2. Grabbing the Contents that I want.
    3. Storing the contents that I want to the CRM database.
    4. Deleting the Email.

    OPTION II (two services)

    SERVICE 1
    Step 1. reads the email.
    Step 2. storing the entire email in an intermediary database table.
    Step 3. Deleting the email
    .
    SERVICE 2
    Step 1. Loop through the the intermediary table 1 record at a time and parse the contents I want from a single field.
    Step 2. Storing the contents that I want to the live CRM database.
    Step 3. If the contents are stored successfully, update a flag in the intermediary table as processed for that record.

    Which is a better way to do this and why?

  2. #2
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    My first question is how many e-mails are you processing a day/hour? My second question, how soon after you putting into the live database, when will you be using it.

    I'd say if it is under a few hundred, your first option is the way to go. If it is thousands, you may want to do it temp then do a cron job at 1am.
    Ryan B | My Blog | Twitter

  3. #3
    SitePoint Guru
    Join Date
    Jun 2006
    Posts
    638
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OPTION II will work better since you can scale your app easier.
    Ex: if your parsing bounces off a few servers, but want to process them on a central server, then your "get email and put in db" script would be simple, small, and installed on all mail servers, and your main parsing script, on the main server.

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do you receive mails? Do you poll a remote mailbox or do you configure a mail server to deliver it directly to your application?

  5. #5
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    How do you receive mails? Do you poll a remote mailbox or do you configure a mail server to deliver it directly to your application?
    I poll a mailserver and login via imap.

    As for the question about the number of emails, I am looking at about 500+ a day.

  6. #6
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rguy84 View Post
    My first question is how many e-mails are you processing a day/hour? My second question, how soon after you putting into the live database, when will you be using it.

    I'd say if it is under a few hundred, your first option is the way to go. If it is thousands, you may want to do it temp then do a cron job at 1am.
    about 500+ emails a day. After getting into the live database, the customer service team may be using it immediately.

  7. #7
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For anyone trying to do something similar, I recommend first reading the following article at phpclasses.org.


    http://www.phpclasses.org/blog/packa...using-PHP.html

  8. #8
    PHP/Rails Developer Czaries's Avatar
    Join Date
    May 2004
    Location
    Central USA
    Posts
    806
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bruin03 View Post
    I poll a mailserver and login via imap.

    As for the question about the number of emails, I am looking at about 500+ a day.
    I would highly recommend email piping instead. Just pipe the incoming email to a php script that parses it and stores it in your database table. I used email polling with IMAP login for DisposeaMail, and recently had to switch to email piping due to the sheer volume of incoming email. The polling script always lagged behind, and eventually stopped working completely (timed out) as the unread email inbox grew larger and larger.

  9. #9
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any links to good tutorials or articles explainin?

    I hope it wouldn't require root access as the client has shared hosting with no plans of upgrading anytime soon.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •