1Log::Dispatch::Email(3)User Contributed Perl DocumentatioLnog::Dispatch::Email(3)
2
3
4
6 Log::Dispatch::Email - Base class for objects that send log messages
7 via email
8
10 version 2.71
11
13 package Log::Dispatch::Email::MySender;
14
15 use Log::Dispatch::Email;
16 use base qw( Log::Dispatch::Email );
17
18 sub send_email {
19 my $self = shift;
20 my %p = @_;
21
22 # Send email somehow. Message is in $p{message}
23 }
24
26 This module should be used as a base class to implement
27 Log::Dispatch::* objects that send their log messages via email.
28 Implementing a subclass simply requires the code shown in the
29 "SYNOPSIS" with a real implementation of the send_email() method.
30
32 The constructor takes the following parameters in addition to the
33 standard parameters documented in Log::Dispatch::Output:
34
35 • subject ($)
36
37 The subject of the email messages which are sent. Defaults to "$0:
38 log email"
39
40 • to ($ or \@)
41
42 Either a string or a list reference of strings containing email
43 addresses. Required.
44
45 • from ($)
46
47 A string containing an email address. This is optional and may not
48 work with all mail sending methods.
49
50 • buffered (0 or 1)
51
52 This determines whether the object sends one email per message it
53 is given or whether it stores them up and sends them all at once.
54 The default is to buffer messages.
55
57 This class provides the following methods:
58
59 $email->send_email(%p)
60 This is the method that must be subclassed. For now the only parameter
61 in the hash is 'message'.
62
63 $email->flush
64 If the object is buffered, then this method will call the send_email()
65 method to send the contents of the buffer and then clear the buffer.
66
67 $email->DESTROY
68 On destruction, the object will call flush() to send any pending email.
69
71 Bugs may be submitted at
72 <https://github.com/houseabsolute/Log-Dispatch/issues>.
73
75 The source code repository for Log-Dispatch can be found at
76 <https://github.com/houseabsolute/Log-Dispatch>.
77
79 Dave Rolsky <autarch@urth.org>
80
82 This software is Copyright (c) 2023 by Dave Rolsky.
83
84 This is free software, licensed under:
85
86 The Artistic License 2.0 (GPL Compatible)
87
88 The full text of the license can be found in the LICENSE file included
89 with this distribution.
90
91
92
93perl v5.38.0 2023-07-20 Log::Dispatch::Email(3)