Supprimer un message
pipo
Alors voilà mon script tout con
Des smileys dans le code ???
- <?php
- function str_clean($texte)
- {
- $str = chr(13);
- $ptemp1 = str_replace ($str,"",$texte);
- $str = chr(10);
- $ptemp1 = str_replace ("&","&",$ptemp1);
- $ptemp1 = str_replace ($str,"",$ptemp1);
- $ptemp1 = str_replace ("'","´",str_replace ('"',""",$ptemp1));
- $ptemp1 = stripslashes($ptemp1);
- return $ptemp1;
- }
- function printdate()
- {
- return date("d/m/Y @ H:i:s");
- }
- // Open a log file
- $log=fopen("c scripts/smslog.log","a+");
- // Open Imap connection with Mail server
- $mbox = imap_open("{xxxx.gatewaycomms.com:xxxx}INBOX", "xxx", "xxxx");
- // for each message do
- $message_count=imap_num_msg($mbox);
- fputs($log,printdate()." : ".$message_count." new message on server\n");
- for ($i = 1; $i <= imap_num_msg($mbox); $i++)
- {
- $header = imap_headerinfo($mbox, $i, 80, 80);
- $subject= $header->fetchsubject;
- $sender=$header->fromaddress;
- $messageBody = imap_body($mbox, $i);
- $sender=substr($sender,strpos($sender,"<"));
- $sender=str_replace("<","",$sender);
- $sender=str_replace(">","",$sender);
- print "Message #$i\n";
- print "From : $sender\n";
- print "Subject : $subject\n";
- print "Text to send : $messageBody\n";
- fputs($log,printdate()." : SMS Request from $sender to mobile number $subject\n");
- // Delete the mail
- imap_delete($mbox, $i);
- // Create the file
- $filename="c OutBox/".$subject;
- $filename=str_clean($filename);
- print $filename;
- $file=fopen($filename,"w+");
- fputs($file,"$messageBody sent from $sender");
- fclose($file);
- fputs($log,printdate()." : File created on $filename\n");
- }
- imap_expunge($mbox);
- fputs($log,printdate()." : Delete $message_count mails from server\n");
- imap_close($mbox);
- fclose($log);
- ?>"
Des smileys dans le code ???