Skip to content

Instantly share code, notes, and snippets.

@charlycoste
Created December 10, 2013 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlycoste/7894273 to your computer and use it in GitHub Desktop.
Save charlycoste/7894273 to your computer and use it in GitHub Desktop.
<?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