Parse email and execute command

Discussion in 'PHP' started by blackburn2413, Feb 17, 2011.

  1. #1
    Hello everyone, wanted to get pointed in the right direction or see if this is even possible. I have some basic emails one of my inboxes receives that are all in a standard format. If there any way to code a script that can read any new emails an account has, parse the requested data from that email (name, phone number, date), and then assign that data to a variable? I assume if it can be done I can use cron commands to execute the command every so often...

    What I will end up doing is running an SQL query with those variables after the fact, but I can handle that pretty easily.

    So the biggest thing mentioned above- can I parse data from all incoming emails and assign that data to variables? Even a pointer in the right direction will help!

    Thanks!
     
    blackburn2413, Feb 17, 2011 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Yes, you can do it, if POP is enabled for the mail account you are talking about.

    Here is the flow:
    1. Read emails via POP3.
    2. Loop through each mail and parse the data by the format of the email.
    3. Store email content & data in a database table for reference.
    4. Process the data the way you wish.
     
    mastermunj, Feb 17, 2011 IP
  3. blackburn2413

    blackburn2413 Member

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Sounds like a pretty straight forward process. I am going to start at the beginning and find out how to read emails through php. Thats all new to me :)
     
    blackburn2413, Feb 18, 2011 IP