Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-27-2010, 01:08 PM   PM User | #1
RyanB88
Regular Coder

 
Join Date: Mar 2005
Location: Spokane, WA
Posts: 146
Thanks: 4
Thanked 3 Times in 3 Posts
RyanB88 is an unknown quantity at this point
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.
RyanB88 is offline   Reply With Quote
Old 11-27-2010, 04:56 PM   PM User | #2
jim_keller
New Coder

 
Join Date: Nov 2010
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
jim_keller is an unknown quantity at this point
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
?>
jim_keller is offline   Reply With Quote
Old 11-28-2010, 01:42 AM   PM User | #3
RyanB88
Regular Coder

 
Join Date: Mar 2005
Location: Spokane, WA
Posts: 146
Thanks: 4
Thanked 3 Times in 3 Posts
RyanB88 is an unknown quantity at this point
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.
RyanB88 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:34 PM.


Advertisement
Log in to turn off these ads.