--TEST-- Test mail() function : basic functionality --SKIPIF-- --INI-- max_execution_time = 120 --FILE-- 0) { // sleep for a while to allow msg to be delivered sleep(1); $current_msg_count = imap_check($imap_stream)->Nmsgs; // Iterate over recent msgs to find the one we sent above for ($i = 1; $i <= $current_msg_count; $i++) { // get hdr details $hdr = imap_headerinfo($imap_stream, $i); if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) { echo "Id of msg just sent is $i\n"; echo ".. delete it\n"; imap_delete($imap_stream, $i); $found = true; break; } } $repeat_count -= 1; } if (!$found) { echo "TEST FAILED: email not delivered\n"; } else { echo "TEST PASSED: Msgs sent and deleted OK\n"; } imap_close($imap_stream, CL_EXPUNGE); ?> ===DONE=== --EXPECTF-- *** Testing mail() : basic functionality *** Warning: mail(): Failed to connect to mailserver at "localhost" port 2525, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in %s on line %d TEST COMPLETED : Unable to send test email