aboutsummaryrefslogtreecommitdiff
path: root/vendor/email_message/debug_message.php
blob: 48825702335169906ccf171f90cf2faaa2051260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/*
 * debug_message.php
 *
 *
 *
 */


class debug_message_class extends email_message_class
{
    private $logfile = '';

    function __construct() {
        $this->logfile = implode('/', [
            $GLOBALS['TMP_PATH'],
            $GLOBALS['DEBUG_MAIL_LOG_FILE_NAME'] ?? 'studip-mail-debug.log'
        ]);
    }

	function SendMail($to,$subject,$body,$headers,$return_path) {
		if ($log = fopen($this->logfile, "a")){
			if(strlen($headers)) $headers.="\n";
			fwrite($log, "\n-- " . strftime("%x %X"). ' ' . $GLOBALS['user']->username);
			fwrite($log, "\nTo: ".$to."\nSubject: ".$subject."\n".$headers."\n");
			fwrite($log,$body."\n");
			fclose($log);
		}
	}
}
?>