xref: /php-src/ext/standard/tests/mail/mail_log.phpt (revision f8d79582)
1--TEST--
2Test mail() function : mail.log ini setting
3--INI--
4sendmail_path={MAIL:mail.out}
5mail.log = mail.log
6--FILE--
7<?php
8date_default_timezone_set("UTC");
9
10$logfile = ini_get("mail.log");
11if (file_exists($logfile)) {
12    unlink($logfile);
13}
14touch($logfile);
15clearstatcache();
16
17$to = "test@example.com";
18$subject = "mail.log test";
19$message = "Testing mail.log";
20$headers = "X-Test: 1";
21
22var_dump(filesize($logfile) == 0);
23clearstatcache();
24
25var_dump(mail($to, $subject, $message, $headers));
26
27var_dump(filesize($logfile) > 0);
28clearstatcache();
29
30echo file_get_contents($logfile);
31?>
32Done
33--CLEAN--
34<?php
35unlink("mail.log");
36unlink("mail.out");
37?>
38--EXPECTF--
39bool(true)
40bool(true)
41bool(true)
42[%d-%s-%d %d:%d:%d UTC] mail() on [%smail_log.php:%d]: To: test@example.com -- Headers: X-Test: 1 -- Subject: mail.log test
43Done
44