1--TEST--
2Test mail() function : basic functionality
3--INI--
4sendmail_path=tee mailBasic.out >/dev/null
5mail.add_x_header = Off
6--SKIPIF--
7<?php
8if(substr(PHP_OS, 0, 3) == "WIN")
9  die("skip Won't run on Windows");
10?>
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@company.com';
24$subject = 'Test Subject';
25$message = 'A Message';
26$additional_headers = 'KHeaders';
27$outFile = "mailBasic.out";
28@unlink($outFile);
29
30echo "-- All Mail Content Parameters --\n";
31// Calling mail() with all additional headers
32var_dump( mail($to, $subject, $message, $additional_headers) );
33echo file_get_contents($outFile);
34unlink($outFile);
35
36echo "\n-- Mandatory Parameters --\n";
37// Calling mail() with mandatory arguments
38var_dump( mail($to, $subject, $message) );
39echo file_get_contents($outFile);
40unlink($outFile);
41
42?>
43===DONE===
44--EXPECT--
45*** Testing mail() : basic functionality ***
46-- All Mail Content Parameters --
47bool(true)
48To: user@company.com
49Subject: Test Subject
50KHeaders
51
52A Message
53
54-- Mandatory Parameters --
55bool(true)
56To: user@company.com
57Subject: Test Subject
58
59A Message
60===DONE===
61