http://www.php.net/imap
<?
//include config.php for settings
include("config.php");
if($index != true){
require("database.php");
$db = new database;
}
//conect to mailserver
//dit nog even aanpassen. Het werkt alleen als de mailserver op local host staat :/ en dat is niet iedeaal.
if($mbox = imap_open("{localhost:143}INBOX",$mail_user_id,$mail_password))
{
//check mail
$mtnum = imap_num_msg($mbox);
if($mtnum > 0){
$mnum = 1;
//dit kan ook met een forloop
while($mnum <= $mtnum){
//fetch content
$mcontent = imap_body($mbox,$mnum);
//remove ads and headers
$mexplode = explode($msep,$mcontent);
//check of email == spam
if($mexplode['1'] !=""){
//fetch headers
$mheader = imap_headerinfo($mbox,$mnum);
//replace the emil in header info
$mheader->fromaddress = preg_replace("/<(.*?)\>/si", "", $mheader->fromaddress);
//insert in database
$sql = "INSERT INTO `".$prefix."weblog` (`subject`,`date`,`content`,`author`) VALUES ('".$mheader->subject."','".date($iso, strtotime($mheader->date))."','".onpost($mexplode['1'])."','".$mheader->fromaddress."')";
//sent de query to database.
$db->insert_data($sql);
//send message to trashbin
imap_delete($mbox,$mnum);
}else{
//spam has been found. Send message to the owner
$mheader = imap_headerinfo($mbox,$mnum);
$mspam = "A email send to ".$mail_user." has been detected as spam.
Subject: ".$mheader->subject."
Content: ".$mcontent."
Date: ".date($iso, strtotime($mheader->date))."
This email has been deleted. If this not a spammessage please send the mail again.";
//mail message
mail($mail,' Spam possible detected',$mspam);
//send message to trashbin
imap_delete($mbox,$mnum);
}
$mnum = $mnum + 1;
}
}
//Delete al messages form the "thrashbin"
imap_expunge($mbox);
//disconect form server
imap_close($mbox);
}
?>
Is een script dat email omzet naar een database. Missichien handig