File tree 1 file changed +48
-0
lines changed
1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test mail() function : mail.log ini setting
3
+ --INI--
4
+ sendmail_path=tee /tmp/mail.out >/dev/null
5
+ mail.log = /tmp/mail.log
6
+ --SKIPIF--
7
+ <?php
8
+ if (substr (PHP_OS , 0 , 3 ) == "WIN " )
9
+ die ("skip Won't run on Windows " );
10
+ ?>
11
+ --FILE--
12
+ <?php
13
+ date_default_timezone_set ("UTC " );
14
+
15
+ $ logfile = ini_get ("mail.log " );
16
+ if (file_exists ($ logfile )) {
17
+ unlink ($ logfile );
18
+ }
19
+ touch ($ logfile );
20
+ clearstatcache ();
21
+
22
+ $ to = "test@example.com " ;
23
+ $ subject = "mail.log test " ;
24
+ $ message = "Testing mail.log " ;
25
+ $ headers = "X-Test: 1 " ;
26
+
27
+ var_dump (filesize ($ logfile ) == 0 );
28
+ clearstatcache ();
29
+
30
+ var_dump (mail ($ to , $ subject , $ message , $ headers ));
31
+
32
+ var_dump (filesize ($ logfile ) > 0 );
33
+ clearstatcache ();
34
+
35
+ echo file_get_contents ($ logfile );
36
+ ?>
37
+ Done
38
+ --CLEAN--
39
+ <?php
40
+ unlink ("/tmp/mail.log " );
41
+ unlink ("/tmp/mail.out " );
42
+ ?>
43
+ --EXPECTF--
44
+ bool(true)
45
+ bool(true)
46
+ bool(true)
47
+ [%d-%s-%d %d:%d:%d UTC] mail() on [%smail_log.php:%d]: To: test@example.com -- Headers: X-Test: 1
48
+ Done
You can’t perform that action at this time.
0 commit comments