Created
December 10, 2013 17:11
-
-
Save charlycoste/7894273 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include '../../lib/ezc/Base/src/ezc_bootstrap.php'; | |
$imap = new ezcMailImapTransport( "imap.server.fr" ); | |
$imap->authenticate( "login", "pass" ); | |
$imap->selectMailbox( 'INBOX' ); | |
$set = $imap->fetchAll(); | |
$parser = new ezcMailParser(); | |
$mail = $parser->parseMail( $set ); | |
for ( $i = 0; $i < count( $mail ); $i++ ) | |
{ | |
$parts = $mail[$i]->fetchParts(); | |
foreach ( $parts as $part ) | |
{ | |
if ( $part instanceof ezcMailFile && $part->mimeType == 'pdf') | |
{ | |
// Traitement | |
// Si le traitement réussi, on supprime le mail | |
$imap->delete($i+1); | |
$imap->expunge(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment