1Log::Dispatch::Email::MUasielrSeCnodn(t3r)ibuted Perl DoLcougm:e:nDtiastpiaotnch::Email::MailSend(3)
2
3
4
6 Log::Dispatch::Email::MailSend - Subclass of Log::Dispatch::Email that
7 uses the Mail::Send module
8
10 use Log::Dispatch::Email::MailSend;
11
12 my $email =
13 Log::Dispatch::Email::MailSend->new
14 ( name => 'email',
15 min_level => 'emerg',
16 to => [ qw( foo@bar.com bar@baz.org ) ],
17 subject => 'Oh no!!!!!!!!!!!', );
18
19 $email->log( message => 'Something bad is happening', level => 'emerg' );
20
22 This is a subclass of Log::Dispatch::Email that implements the
23 send_email method using the Mail::Send module.
24
26 * new
27 This method takes a hash of parameters. The following options are
28 valid:
29
30 * name ($)
31 The name of the object (not the filename!). Required.
32
33 * min_level ($)
34 The minimum logging level this object will accept. See the
35 Log::Dispatch documentation on Log Levels for more informa‐
36 tion. Required.
37
38 * max_level ($)
39 The maximum logging level this obejct will accept. See the
40 Log::Dispatch documentation on Log Levels for more informa‐
41 tion. This is not required. By default the maximum is the
42 highest possible level (which means functionally that the
43 object has no maximum).
44
45 * subject ($)
46 The subject of the email messages which are sent. Defaults
47 to "$0: log email"
48
49 * to ($ or \@)
50 Either a string or a list reference of strings containing
51 email addresses. Required.
52
53 * from ($)
54 A string containing an email address. This is optional and
55 may not work with all mail sending methods.
56
57 * buffered (0 or 1)
58 This determines whether the object sends one email per mes‐
59 sage it is given or whether it stores them up and sends
60 them all at once. The default is to buffer messages.
61
62 * callbacks( \& or [ \&, \&, ... ] )
63 This parameter may be a single subroutine reference or an
64 array reference of subroutine references. These callbacks
65 will be called in the order they are given and passed a
66 hash containing the following keys:
67
68 ( message => $log_message, level => $log_level )
69
70 The callbacks are expected to modify the message and then
71 return a single scalar containing that modified message.
72 These callbacks will be called when either the "log" or
73 "log_to" methods are called and will only be applied to a
74 given message once.
75
76 * log_message( level => $, message => $ )
77 Sends a message if the level is greater than or equal to the
78 object's minimum level.
79
81 Since "Mail::Send" is a subclass of "Mail::Mailer", you can change how
82 mail is sent from this module by simply "use"ing "Mail::Mailer" in your
83 code before mail is sent. For example, to send mail via smtp, you
84 could do:
85
86 use Mail::Mailer 'smtp', Server => 'foo.example.com';
87
88 For more details, see the "Mail::Mailer" docs.
89
91 Dave Rolsky, <autarch@urth.org>
92
94 Log::Dispatch, Log::Dispatch::ApacheLog, Log::Dispatch::Email,
95 Log::Dispatch::Email::MailSendmail, Log::Dispatch::Email::MIMELite,
96 Log::Dispatch::File, Log::Dispatch::Handle, Log::Dispatch::Output,
97 Log::Dispatch::Screen, Log::Dispatch::Syslog
98
99
100
101perl v5.8.8 2006-12-20 Log::Dispatch::Email::MailSend(3)