$value){
if (trim($value) == "Content-Transfer-Encoding: base64"){
$base64Flag = true;
}
if (strlen(stristr($value, "Subject"))>1){
$subjects = trim(stristr($value, " "));
//look for IncidentNo in the subject to see if we need to attempt to process the email
if (strlen(stristr($subjects, "IncidentNo:"))>1){
$TIRSFlag = true;
}// end if
}// end if
//get the date of the email
if (strlen(stristr($value, "Date"))>1){
$dates = trim(stristr($value, " "));
$date_key = $key;
}// end if
//the body
if (strlen(trim($value))==0){
if ($body_start_key == false){ $body_start_key = true; } //set the start key for the body
}//end if
if ($body_start_key == true){
$body .= trim($value);
if ($base64Flag == false){ $body .="
"; }
}// end if
}// end foreach
// only create incident if the subject line contains the word incident
if ($TIRSFlag == false){
//delete the message
delete($msgNo, $fp);
}else{
//decode the message if its base64 encoded
if ($base64Flag == true) {
$body = base64_decode($body);
}//end if
// call the function that does the sql inserts
create_incident($subjects, $body, $msgNo, $fp);
}// end if
}// end function
//-----------------------------------------------------------------------------
// Create the incident
//-----------------------------------------------------------------------------
function create_incident($subject, $message_body, $msgNo, $fp)
{
//process the body of the email and take it apart and find stuff in it...do whatever processing you need to here
//the code below is simply a hint and probably not relevant to your situation
//its strictly here as a guide as to what can be done with the body of the email
//my application takes the subject and body apart and creates a record in our web-based
//application's database (the code for this has been removed...)
// declarations for function
$inc_sec_off = '';
$inc_site = '';
$inc_type = '';
$inc_issue = '';
$inc_co_id = '';
$inc_http = '';
$options = '';
// take the subject apart to get the individual elements
$sub_details = stristr($subject, ":"); // get rest of subject line from the first ':'
$split_subject = explode (" ", $sub_details); // split on space
$incident_no = trim($split_subject[1]); // incident number from email
$incident_type = trim($split_subject[3]); // incident type from email
$inc_date = trim($split_subject[5]); // incident date from email
$inc_dates = explode("/",$inc_date);
if (count($inc_dates)>1){
$inc_date = $inc_dates[2]."-".$inc_dates[0]."-".$inc_dates[1];
//proper date format (Damned Americans)
}//end if
$weekday = date( "l", $inc_date); // get the weekday
$time = strtotime($inc_date . " ". trim($split_subject[6]));
$inc_time = date("H:i:s", strftime($time) ); // incident time from email
//convert the body crlf to tags if not done when the message was built
if (strlen(stristr($message_body," "))==0){
$message_body = nl2br($message_body);
}
// take the body apart to get the individual elements
$body = explode(" ", $message_body);
for ($x=0; $x1) { $inc_sec_off = substr(stristr($body[$x], ":"),1); }
if (strlen(stristr($body[$x], "client_number"))>1) { $inc_site = substr(stristr($body[$x], ":"),1); }
if (strlen(stristr($body[$x], "Company ID"))>1) { $inc_co_id = substr(stristr($body[$x], ":"),1); }
if (strlen(stristr($body[$x], "Are"))>1) { $inc_issue = substr(stristr($body[$x], ":"),1); }
if (strlen(stristr($body[$x], "http"))>1) { $inc_https = explode("//",$body[$x]); }
}// end for loop
//echo $message_body;
//delete the email if the insertion was succesful
if ($result && $result1){
delete ($msgNo, $fp);
}// end if
}// end function
?>
Partneroldalak: Domain regisztráció tár és szerverszolgáltatások: domain domainnév tárhely e-mail, imap, pop3 www.webtar.hu www.micropay.hu www.ingyenweb.hu www.videok.hu www.antikvárium.hu www.ftpdir.hu www.fotók.hu www.randi.hu www.licit.hu www.napivicc.hu www.gyertyalang.hu www.helyesírás.hu Domain regisztráció