/usr/share/php/Analog/Handler/Mail.php is in php-analog 1.0.7-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <?php
namespace Analog\Handler;
/**
* Send the log message to the specified email address.
*
* Usage:
*
* Analog::handler (Analog\Handler\Mail::init (
* 'you@example.com', // to
* 'Subject line', // subject
* 'no-reply@example.com' // from
* ));
*/
class Mail {
public static function init ($to, $subject, $from) {
return function ($info, $buffered = false) use ($to, $subject, $from) {
if($info=="") return; // do not send empty mail.
$headers = sprintf ("From: %s\r\nContent-type: text/plain; charset=utf-8\r\n", $from);
$body = ($buffered)
? "Logged:\n" . $info
: vsprintf ("Machine: %s\nDate: %s\nLevel: %d\nMessage: %s", $info);
mail ($to, $subject, wordwrap ($body, 70), $headers);
};
}
}
|