--TEST-- Test mail() function : basic functionality (win) --SKIPIF-- --INI-- SMTP=localhost smtp_port=25 --FILE-- 'From is not set', 'premise' => function () { ini_set('SMTP', 'localhost'); ini_set('smtp_port', 25); } ], [ 'label' => 'Invalid port', 'premise' => function () { ini_set('SMTP', 'localhost'); ini_set('smtp_port', 2525); ini_set('sendmail_from', 'from@example.com'); } ], [ 'label' => 'Invalid host', 'premise' => function () { ini_set('SMTP', 'localplace'); ini_set('smtp_port', 25); ini_set('sendmail_from', 'from@example.com'); } ], ]; foreach ($cases as $index => ['label' => $label, 'premise' => $premise]) { echo "========== {$label} ==========\n"; $premise(); $to = $users[$index]; $subject = "{$index}: Basic PHPT test for mail() function"; $message = <<getMailsBySubject($subject); $mailBox->logout(); if ($mail->count() > 0) { echo "Found the email.\n\n"; } } ?> --CLEAN-- deleteMailsBySubject($subject); $mailBox->logout(); } ?> --EXPECTF-- ========== From is not set ========== Warning: mail(): Bad Message Return Path in %s on line %d ========== Invalid port ========== 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 ========== Invalid host ========== Warning: mail(): Failed to connect to mailserver at "localplace" port 1025, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in %s on line %d