$mbox = imap_open ("{your.imap.host}INBOX", "username", "password") or die ("can't connect: ". imap_last_error()); $check = imap_mailboxmsginfo ($mbox); print "Messages before delete:". $check - Nmsgs. "br \n"; imap_delete ($mbox, 1); $check = imap_mailboxmsginfo ($mbox); print "Messages after delete: ". $check - Nmsgs." br \n "; imap_expunge ($mbox); $check = imap_mailboxmsginfo ($mbox); print "Messages after expunge:". $check - Nmsgs. "br \n"; imap_close ($mbox);
?php $mbox = imap_open ("{your.imap.host}INBOX", "utilisateur", "mot_de_passe") or die ("connexion impossible: ". imap_last_error()); $check = imap_mailboxmsginfo ($mbox); print "Nombre de messages avant effacement:". $check - Nmsgs. "br \n"; imap_delete ($mbox, 1); $check = imap_mailboxmsginfo ($mbox); print "Nombre de messages après effacement: ". $check - Nmsgs." br \n "; imap_expunge ($mbox); $check = imap_mailboxmsginfo ($mbox); print "Nombre de messages après imap_expunge:". $check - Nmsgs. "br \n"; imap_close ($mbox);?