[insert_php]
$address = “test@jadednation.com”;
$passy = “jaded123”;
// ARRAY OF MESSAGE HEADERS TO LOOK FOR
//$headers= array (test1,test2,test3,test4);
$headers = array ();
$ini= file(‘/homepages/4/d87217951/htdocs/jadednationWP/wp-content/themes/smpl-skeleton/EMAIL_INI.php’);
$headers = array ();
foreach ($ini as $thingy) {
$ok = rtrim($thingy);
array_push ($headers,$ok);
}
date_default_timezone_set(‘America/Los_Angeles’);
$fulldate= date(“D M j G:i:s T Y”);
$today = date(“j M Y”);
// STYLE
echo ”
“;
// DELETE YESTERDAY’S MAIL
$mbox = imap_open(“{imap.1and1.com:143}”, $address, $passy)
or die(“can’t connect: ” . imap_last_error());
$MC = imap_check($mbox);
$result = imap_fetch_overview($mbox,”1:{$MC->Nmsgs}”,0);
foreach ($result as $overview) {
$msdate = “{$overview->date}”;
$position= strpos($msdate, $today);
if ($position === false) {
$msgno = “{$overview->msgno}”;
imap_delete($mbox, “$msgno:$msgno”);
}
}
imap_expunge($mbox);
imap_close($mbox);
$mailsubjects = array ();
$rawheaders= array ();
//CHECK TODAY’S MAIL
echo “Today’s date: ” . $fulldate. “
“;
$mbox = imap_open(“{imap.1and1.com:143}”, $address, $passy)
or die(“can’t connect: ” . imap_last_error());
$MC = imap_check($mbox);
// Fetch an overview for all messages in inbox
$result = imap_fetch_overview($mbox,”1:{$MC->Nmsgs}”,0);
foreach ($result as $overview) {
$mssubject= “{$overview->subject}”;
array_push ($mailsubjects,”{$overview->subject} Rcvd: {$overview->date}”);
// echo “MSG No:{$overview->msgno}
Date: ({$overview->date})
From: {$overview->from}
// Subject: {$overview->subject}
\n”;
}
imap_close($mbox);
//COMPARE ARRAYS
//convert the mailsubjects array to a string for comparability:
$result_string = join(‘,’, $mailsubjects);
foreach ($headers as $item) {
$matcher= strpos($result_string, $item);
if ($matcher === false) {
echo “
“;
} else {
echo “
“;
array_push ($rawheaders, $item);
}
}
echo “
ALL Received Data details:
“;
foreach ($mailsubjects as $individual) {
echo “$individual
“;
}
[/insert_php]