1Mail::Transport::Send(3U)ser Contributed Perl DocumentatiMoanil::Transport::Send(3)
2
3
4
6 Mail::Transport::Send - send a message
7
9 Mail::Transport::Send
10 is a Mail::Transport
11 is a Mail::Reporter
12
13 Mail::Transport::Send is extended by
14 Mail::Transport::Exim
15 Mail::Transport::Mailx
16 Mail::Transport::Qmail
17 Mail::Transport::SMTP
18 Mail::Transport::Sendmail
19
21 my $message = Mail::Message->new(...);
22
23 # Some extensions implement sending:
24 $message->send;
25 $message->send(via => 'sendmail');
26
27 my $sender = Mail::Transport::SMTP->new(...);
28 $sender->send($message);
29
31 Send a message to the destinations as specified in the header. The
32 "Mail::Transport::Send" module is capable of autodetecting which of the
33 following modules work on your system; you may simply call "send"
34 without "via" options to get a message transported.
35
36 • Mail::Transport::Sendmail
37
38 Use sendmail to process and deliver the mail. This requires the
39 "sendmail" program to be installed on your system. Whether this is
40 an original sendmail, or a replacement from Postfix does matter.
41
42 • Mail::Transport::Exim
43
44 Use "exim" to distribute the message.
45
46 • Mail::Transport::Qmail
47
48 Use "qmail-inject" to distribute the message.
49
50 • Mail::Transport::SMTP
51
52 In this case, Perl is handling mail transport on its own. This is
53 less desired but more portable than sending with sendmail or qmail.
54 The advantage is that this sender is environment independent, and
55 easier to configure. However, there is no daemon involved which
56 means that your program will wait until the message is delivered,
57 and the message is lost when your program is interrupted during
58 delivery (which may take hours to complete).
59
60 • Mail::Transport::Mailx
61
62 Use the external "mail", "mailx", or "Mail" programs to send the
63 message. Usually, the result is poor, because some versions of
64 these programs do not support MIME headers. Besides, these
65 programs are known to have exploitable security breaches.
66
67 Extends "DESCRIPTION" in Mail::Transport.
68
70 Extends "METHODS" in Mail::Transport.
71
72 Constructors
73 Extends "Constructors" in Mail::Transport.
74
75 Mail::Transport::Send->new(%options)
76 -Option --Defined in --Default
77 executable Mail::Transport undef
78 hostname Mail::Transport 'localhost'
79 interval Mail::Transport 30
80 log Mail::Reporter 'WARNINGS'
81 password Mail::Transport undef
82 port Mail::Transport undef
83 proxy Mail::Transport undef
84 retry Mail::Transport <false>
85 timeout Mail::Transport 120
86 trace Mail::Reporter 'WARNINGS'
87 username Mail::Transport undef
88 via Mail::Transport 'sendmail'
89
90 executable => FILENAME
91 hostname => HOSTNAME|ARRAY
92 interval => SECONDS
93 log => LEVEL
94 password => STRING
95 port => INTEGER
96 proxy => PATH
97 retry => NUMBER|undef
98 timeout => SECONDS
99 trace => LEVEL
100 username => STRING
101 via => CLASS|NAME
102
103 Sending mail
104 $obj->destinations( $message, [$address|ARRAY] )
105 Determine the destination for this message. If a valid $address is
106 defined, this is used to overrule the addresses within the message.
107 If the $address is "undef" it is ignored. It may also be an ARRAY
108 of addresses.
109
110 If no $address is specified, the message is scanned for resent
111 groups (see Mail::Message::Head::Complete::resentGroups()). The
112 addresses found in the first (is latest added) group are used. If
113 no resent groups are found, the normal "To", "Cc", and "Bcc" lines
114 are taken.
115
116 $obj->putContent($message, $fh, %options)
117 Print the content of the $message to the $fh.
118
119 -Option --Default
120 body_only <false>
121 undisclosed <false>
122
123 body_only => BOOLEAN
124 Print only the body of the message, not the whole.
125
126 undisclosed => BOOLEAN
127 Do not print the "Bcc" and "Resent-Bcc" lines. Default false,
128 which means that they are not printed.
129
130 $obj->send($message, %options)
131 Transmit the $message, which may be anything what can be coerced
132 into a Mail::Message, so including Mail::Internet and MIME::Entity
133 messages. It returns true when the transmission was successfully
134 completed.
135
136 -Option --Default
137 interval new(interval)
138 retry new(retry)
139 to undef
140
141 interval => SECONDS
142 retry => INTEGER
143 to => STRING
144 Overrules the destination(s) of the message, which is by default
145 taken from the (Resent-)To, (Resent-)Cc, and (Resent-)Bcc.
146
147 $obj->trySend($message, %options)
148 Try to send the message. This will return true if successful, and
149 false in case some problems where detected. The $? contains the
150 exit status of the command which was started.
151
152 Server connection
153 Extends "Server connection" in Mail::Transport.
154
155 $obj->findBinary( $name, [@directories] )
156 Inherited, see "Server connection" in Mail::Transport
157
158 $obj->remoteHost()
159 Inherited, see "Server connection" in Mail::Transport
160
161 $obj->retry()
162 Inherited, see "Server connection" in Mail::Transport
163
164 Error handling
165 Extends "Error handling" in Mail::Transport.
166
167 $obj->AUTOLOAD()
168 Inherited, see "Error handling" in Mail::Reporter
169
170 $obj->addReport($object)
171 Inherited, see "Error handling" in Mail::Reporter
172
173 $obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level,
174 $callback] )
175 Mail::Transport::Send->defaultTrace( [$level]|[$loglevel,
176 $tracelevel]|[$level, $callback] )
177 Inherited, see "Error handling" in Mail::Reporter
178
179 $obj->errors()
180 Inherited, see "Error handling" in Mail::Reporter
181
182 $obj->log( [$level, [$strings]] )
183 Mail::Transport::Send->log( [$level, [$strings]] )
184 Inherited, see "Error handling" in Mail::Reporter
185
186 $obj->logPriority($level)
187 Mail::Transport::Send->logPriority($level)
188 Inherited, see "Error handling" in Mail::Reporter
189
190 $obj->logSettings()
191 Inherited, see "Error handling" in Mail::Reporter
192
193 $obj->notImplemented()
194 Inherited, see "Error handling" in Mail::Reporter
195
196 $obj->report( [$level] )
197 Inherited, see "Error handling" in Mail::Reporter
198
199 $obj->reportAll( [$level] )
200 Inherited, see "Error handling" in Mail::Reporter
201
202 $obj->trace( [$level] )
203 Inherited, see "Error handling" in Mail::Reporter
204
205 $obj->warnings()
206 Inherited, see "Error handling" in Mail::Reporter
207
208 Cleanup
209 Extends "Cleanup" in Mail::Transport.
210
211 $obj->DESTROY()
212 Inherited, see "Cleanup" in Mail::Reporter
213
215 Warning: Message has no destination
216 It was not possible to figure-out where the message is intended to
217 go to.
218
219 Error: Package $package does not implement $method.
220 Fatal error: the specific package (or one of its superclasses) does
221 not implement this method where it should. This message means that
222 some other related classes do implement this method however the
223 class at hand does not. Probably you should investigate this and
224 probably inform the author of the package.
225
226 Warning: Resent group does not specify a destination
227 The message which is sent is the result of a bounce (for instance
228 created with Mail::Message::bounce()), and therefore starts with a
229 "Received" header field. With the "bounce", the new destination(s)
230 of the message are given, which should be included as "Resent-To",
231 "Resent-Cc", and "Resent-Bcc".
232
233 The "To", "Cc", and "Bcc" header information is only used if no
234 "Received" was found. That seems to be the best explanation of the
235 RFC.
236
237 As alternative, you may also specify the "to" option to some of the
238 senders (for instance Mail::Transport::SMTP::send(to) to overrule
239 any information found in the message itself about the destination.
240
241 Error: Transporters of type $class cannot send.
242 The Mail::Transport object of the specified type can not send
243 messages, but only receive message.
244
246 This module is part of Mail-Transport distribution version 3.005, built
247 on July 22, 2020. Website: http://perl.overmeer.net/CPAN/
248
250 Copyrights 2001-2020 by [Mark Overmeer]. For other contributors see
251 ChangeLog.
252
253 This program is free software; you can redistribute it and/or modify it
254 under the same terms as Perl itself. See http://dev.perl.org/licenses/
255
256
257
258perl v5.32.1 2021-01-27 Mail::Transport::Send(3)