Please, enter IMAP mailbox address, login and password (prefilled for an example)

Examples of some IMAP servers (must enable IMAP in settings)

Script does NOT save any provided information
personal)) { $emailList .= $object->personal; } $nameList .= ';'; if (isset($object->mailbox) && isset($object->host)) { $nameList .= $object->mailbox . "@" . $object->host; } } $emailList = ltrim($emailList, ';'); $nameList = ltrim($nameList, ';'); } function processMessage($mbox, $messageNumber, $myfile) { echo $messageNumber; // get imap_fetch header and put single lines into array $header = imap_rfc822_parse_headers(imap_fetchheader($mbox, $messageNumber)); $fromEmailList = ''; $fromNameList = ''; if (isset($header->from)) { getAddressText($fromEmailList, $fromNameList, $header->from); } $toEmailList = ''; $toNameList = ''; if (isset($header->to)) { getAddressText($toEmailList, $toNameList, $header->to); } $body = imap_fetchbody($mbox, $messageNumber, 1); $bodyEmailList = implode(';', extractEmail($body)); $txt = ( ',' . $fromEmailList . ',' . $fromNameList . ',' . $toEmailList . ',' . $toNameList . ',' . $bodyEmailList . "\n" ); fwrite($myfile, $txt); } // imap_timeout(IMAP_OPENTIMEOUT, 300); // Open pop mailbox if (!$mbox = imap_open($_REQUEST['mailbox'], $_REQUEST['login'], $_REQUEST['password'])) { die('Cannot connect/check pop mail! Exiting'); } if ($hdr = imap_check($mbox)) { $msgCount = $hdr->Nmsgs; } else { echo "Failed to get mail"; exit; } echo "
";
    echo 'emails count=' . $msgCount . "\n\n\n";
    echo "record number,from emails list,from names list,to emails list, to names list,extracted from body\n";

    /* might improve performance according to
       http://www.php.net/manual/en/function.imap-headerinfo.php#98809 
       imap_headers($mbox);
    */
	$myfile = fopen('json/bounce_list.csv', "w") or die("Unable to open file: json/bounce_list.csv");

    for ($X = 1; $X <= min($msgCount, MAX_EMAIL_COUNT); $X++) {
        processMessage($mbox, $X, $myfile);
    } 
    echo "
"; fclose($myfile); imap_close($mbox); } ?>