Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Location
    Spokane, WA
    Posts
    148
    Thanks
    4
    Thanked 4 Times in 4 Posts

    Pipe email to PHP script to be parsed

    I am looking to pipe emails sent to an address at a specific subdomain to a php script, my control panel (cPanel) has an option to pipe such emails to a php script. I just need help finding examples on how to retreive the email contents piped to my script and how to parse the email to make a MySQL entry for it. Specifically I am working on developing a help desk system and i will need to seperate the sender, subject, and email body (ignoring any quoted contents of the body) to create a ticket in my db.

    Any idea where I can find a function or class to do this. I need it to be GPL v2 or a compatible license as the code will be used in a project I am developing that I will release as GPL v2.

    Thanks.

  • #2
    New Coder
    Join Date
    Nov 2010
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post
    Basically you need to use fopen() to read from the special "stdin" wrapper. Something like this should work:

    PHP Code:
    <?php
    $fp 
    fopen("php://stdin","r"); 
    $email_data '';
    while ( 
    $line fgets($fp) ) {
       
    $email_data .= $line 
    }

    //$email_data should now contain the piped-in input
    ?>

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Location
    Spokane, WA
    Posts
    148
    Thanks
    4
    Thanked 4 Times in 4 Posts
    WHat I need is good well written open source code that can do this for me. I am not looking to build my own from scatch. THeir is no need to reinvent the wheel here so to speak and it would be rather difficult to do so. Plus I would have no clue how to deal with diffrent types of encoding anf MIME types.

    Thus I am just looking for something that already does that for me.


  •  

    Posting Permissions

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