1--TEST-- 2Test mail() function : basic functionality 3--SKIPIF-- 4<?php 5if(substr(PHP_OS, 0, 3) == "WIN") 6 die("skip Won't run on Windows"); 7?> 8--INI-- 9sendmail_path="cat > /tmp/php_test_mailBasic2.out" 10mail.add_x_header = Off 11--FILE-- 12<?php 13/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]]) 14 * Description: Send an email message 15 * Source code: ext/standard/mail.c 16 * Alias to functions: 17 */ 18 19echo "*** Testing mail() : basic functionality ***\n"; 20 21 22// Initialise all required variables 23$to = 'user@example.com'; 24$subject = 'Test Subject'; 25$message = 'A Message'; 26$additional_headers = 'KHeaders'; 27$additional_parameters = "-n"; 28$outFile = "/tmp/php_test_mailBasic2.out"; 29@unlink($outFile); 30 31echo "-- extra parameters --\n"; 32// Calling mail() with all possible arguments 33var_dump( mail($to, $subject, $message, $additional_headers, $additional_parameters) ); 34 35echo file_get_contents($outFile); 36unlink($outFile); 37?> 38===DONE=== 39--EXPECTF-- 40*** Testing mail() : basic functionality *** 41-- extra parameters -- 42bool(true) 43%w1%wTo: user@example.com 44%w2%wSubject: Test Subject 45%w3%wKHeaders 46%w4%w 47%w5%wA Message 48===DONE=== 49