--TEST-- Test mail() function : basic functionality (win) --SKIPIF-- --INI-- SMTP=localhost smtp_port=25 --FILE-- 'from@example.com', 'premise' => function ($from, $to, $subject, $message) { ini_set('sendmail_from', $from); return mail($to, $subject, $message); } ], [ 'from' => 'ex_from@example.com', 'premise' => function ($from, $to, $subject, $message) { ini_restore('sendmail_from'); $headers = "from: {$from}"; return mail($to, $subject, $message, $headers); } ], [ 'from' => 'ex_from@example.com', 'premise' => function ($from, $to, $subject, $message) { ini_restore('sendmail_from'); $headers = "FRom: {$from}"; return mail($to, $subject, $message, $headers); } ], [ 'from' => 'ex_from@example.com', 'premise' => function ($from, $to, $subject, $message) { ini_restore('sendmail_from'); $headers = "from: {$from}"; $parameters = 'addons'; // should be ignored return mail($to, $subject, $message, $headers, $parameters); } ], ]; foreach ($cases as $index => ['from' => $from, 'premise' => $premise]) { echo "========== Case {$index} ==========\n"; $to = $users[$index]; $subject = "{$index}: Basic PHPT test for mail() function"; $message = <<getMailsBySubject($subject); $mailBox->logout(); if ($mail->isAsExpected($from, $to, $subject, $message)) { echo "Found the email.\n\n"; } } ?> --CLEAN-- deleteMailsBySubject($subject); $mailBox->logout(); } ?> --EXPECT-- ========== Case 0 ========== Email sent. Found the email. ========== Case 1 ========== Email sent. Found the email. ========== Case 2 ========== Email sent. Found the email. ========== Case 3 ========== Email sent. Found the email.