1Log::Dispatch::Email::MUasielrSeCnodnetrr(i3b)uted PerlLDoogc:u:mDeinstpaatticohn::Email::MailSender(3)
2
3
4
6 Log::Dispatch::Email::MailSender - Subclass of Log::Dispatch::Email
7 that uses the Mail::Sender module
8
10 use Log::Dispatch::Email::MailSender;
11
12 my $email =
13 Log::Dispatch::Email::MailSender->new
14 ( name => 'email',
15 min_level => 'emerg',
16 to => [ qw( foo@bar.com bar@baz.org ) ],
17 subject => 'Oh no!!!!!!!!!!!',
18 smtp => 'mail.foo.bar' );
19
20 $email->log( message => 'Something bad is happening', level => 'emerg' );
21
23 This is a subclass of Log::Dispatch::Email that implements the
24 send_email method using the Mail::Sender module.
25
27 * new
28 This method takes a hash of parameters. The following options are
29 valid:
30
31 * name ($)
32 The name of the object (not the filename!). Required.
33
34 * min_level ($)
35 The minimum logging level this object will accept. See the
36 Log::Dispatch documentation on Log Levels for more informa‐
37 tion. Required.
38
39 * max_level ($)
40 The maximum logging level this obejct will accept. See the
41 Log::Dispatch documentation on Log Levels for more informa‐
42 tion. This is not required. By default the maximum is the
43 highest possible level (which means functionally that the
44 object has no maximum).
45
46 * subject ($)
47 The subject of the email messages which are sent. Defaults
48 to "$0: log email"
49
50 * to ($ or \@)
51 Either a string or a list reference of strings containing
52 email addresses. Required.
53
54 * from ($)
55 A string containing an email address. This is optional and
56 may not work with all mail sending methods.
57
58 NOTE: The Mail::Sender module requires an address be passed
59 to it to set this in the mail it sends. We pass in
60 'LogDispatch@foo.bar' as the default.
61
62 * buffered (0 or 1)
63 This determines whether the object sends one email per mes‐
64 sage it is given or whether it stores them up and sends
65 them all at once. The default is to buffer messages.
66
67 * smtp ($)
68 A string containing the network address of the SMTP server
69 to use for sending the email. This defaults to localhost.
70
71 * callbacks( \& or [ \&, \&, ... ] )
72 This parameter may be a single subroutine reference or an
73 array reference of subroutine references. These callbacks
74 will be called in the order they are given and passed a
75 hash containing the following keys:
76
77 ( message => $log_message, level => $log_level )
78
79 The callbacks are expected to modify the message and then
80 return a single scalar containing that modified message.
81 These callbacks will be called when either the "log" or
82 "log_to" methods are called and will only be applied to a
83 given message once.
84
85 * log_message( level => $, message => $ )
86 Sends a message if the level is greater than or equal to the
87 object's minimum level.
88
90 Joseph Annino. <jannino@jannino.com>
91
92 Dave Rolsky, <autarch@urth.org>
93
94
95
96perl v5.8.8 2006-12-20Log::Dispatch::Email::MailSender(3)