1Log::Handler::Output::SUesnedrmaCioln(t3r)ibuted Perl DoLcougm:e:nHtaantdiloenr::Output::Sendmail(3)
2
3
4

NAME

6       Log::Handler::Output::Sendmail - Log messages with sendmail.
7

SYNOPSIS

9           use Log::Handler::Output::Sendmail;
10
11           my $email = Log::Handler::Output::Sendmail->new(
12               from    => 'bar@foo.example',
13               to      => 'foo@bar.example',
14               subject => 'your subject',
15           );
16
17           $email->log(message => $message);
18

DESCRIPTION

20       With this output module it's possible to log messages via "sendmail".
21

METHODS

23   new()
24       Call new() to create a new Log::Handler::Output::Sendmail object.
25
26       The following options are possible:
27
28       from
29           The sender address (From).
30
31       to  The receipient address (To).
32
33       cc  Carbon Copy (Cc).
34
35       bcc Blind Carbon Copy (Bcc)
36
37       subject
38           The subject of the mail.
39
40       sender
41           This option is identical with "sendmail -f".
42
43       header
44           With this options it's possible to set your own header.
45
46               my $email = Log::Handler::Output::Sendmail->new(
47                   from   => 'bar@foo.example',
48                   to     => 'foo@bar.example',
49                   header => 'Content-Type: text/plain; charset= UTF-8',
50               );
51
52           Or
53
54               my $email = Log::Handler::Output::Sendmail->new(
55                   header => {
56                       From    => 'bar@foo.example',
57                       To      => 'foo@bar.example',
58                       Subject => 'my subject',
59                       'Content-Type' => text/plain; charset= UTF-8',
60                   }
61               );
62
63           Or
64
65               my $email = Log::Handler::Output::Sendmail->new(
66                   header => [
67                       'From: bar@foo.example',
68                       'To: foo@bar.example',
69                       'Subject: my subject',
70                       'Content-Type: text/plain; charset= UTF-8',
71                   ]
72               );
73
74       sendmail
75           The default is set to "/usr/sbin/sendmail".
76
77       params
78           Parameters for "sendmail".
79
80           The default is set to "-t".
81
82       maxsize
83           Set the maximum size of the buffer in bytes.
84
85           All messages will be buffered and if "maxsize" is exceeded the
86           buffer is flushed and the messages will be send as email.
87
88           The default is set to 1048576 bytes.
89
90           Set 0 if you want no buffering and send a mail for each log
91           message.
92
93       debug
94           Set 1 if you want to enable debugging.
95
96           The messages can be fetched with $SIG{__WARN__}.
97
98   log()
99       Call log() if you want to log a message as email.
100
101           $email->log(message => "this message will be mailed");
102
103       If you pass the level then its placed into the subject:
104
105           $email->log(message => "foo", level => "INFO");
106           $email->log(message => "bar", level => "ERROR");
107           $email->log(message => "baz", level => "DEBUG");
108
109       The lowest level is used:
110
111           Subject: ERROR ...
112
113       You can pass the level with "Log::Handler" by setting
114
115           message_pattern => '%L'
116
117   flush()
118       Call flush() if you want to flush the buffered messages.
119
120   validate()
121       Validate a configuration.
122
123   reload()
124       Reload with a new configuration.
125
126   errstr()
127       This function returns the last error message.
128

DESTROY

130       "DESTROY" is defined and called flush().
131

PREREQUISITES

133           Carp
134           Params::Validate
135

EXPORTS

137       No exports.
138

REPORT BUGS

140       Please report all bugs to <jschulz.cpan(at)bloonix.de>.
141
142       If you send me a mail then add Log::Handler into the subject.
143

AUTHOR

145       Jonny Schulz <jschulz.cpan(at)bloonix.de>.
146
148       Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved.
149
150       This program is free software; you can redistribute it and/or modify it
151       under the same terms as Perl itself.
152
153
154
155perl v5.36.0                      2023-01-20 Log::Handler::Output::Sendmail(3)
Impressum