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
68 Constructors
69 Mail::Transport::Send->new(OPTIONS)
70 -Option --Defined in --Default
71 executable Mail::Transport undef
72 hostname Mail::Transport 'localhost'
73 interval Mail::Transport 30
74 log Mail::Reporter 'WARNINGS'
75 password Mail::Transport undef
76 port Mail::Transport undef
77 proxy Mail::Transport undef
78 retry Mail::Transport <false>
79 timeout Mail::Transport 120
80 trace Mail::Reporter 'WARNINGS'
81 username Mail::Transport undef
82 via Mail::Transport 'sendmail'
83
84 executable => FILENAME
85 hostname => HOSTNAME|ARRAY-OF-HOSTNAMES
86 interval => SECONDS
87 log => LEVEL
88 password => STRING
89 port => INTEGER
90 proxy => PATH
91 retry => NUMBER|undef
92 timeout => SECONDS
93 trace => LEVEL
94 username => STRING
95 via => CLASS|NAME
96
97 Sending mail
98 $obj->destinations(MESSAGE, [ADDRESS|ARRAY-OF-ADDRESSES])
99 Determine the destination for this message. If a valid ADDRESS is
100 defined, this is used to overrule the addresses within the message.
101 If the ADDRESS is "undef" it is ignored.
102
103 If no ADDRESS is specified, the message is scanned for resent
104 groups (see Mail::Message::Head::Complete::resentGroups()). The
105 addresses found in the first (is latest added) group are used. If
106 no resent groups are found, the normal "To", "Cc", and "Bcc" lines
107 are taken.
108
109 $obj->putContent(MESSAGE, FILEHANDLE, OPTIONS)
110 Print the content of the MESSAGE to the FILEHANDLE.
111
112 -Option --Default
113 body_only <false>
114 undisclosed <false>
115
116 body_only => BOOLEAN
117 Print only the body of the message, not the whole.
118
119 undisclosed => BOOLEAN
120 Do not print the "Bcc" and "Resent-Bcc" lines. Default false,
121 which means that they are not printed.
122
123 $obj->send(MESSAGE, OPTIONS)
124 Transmit the MESSAGE, which may be anything what can be coerced
125 into a Mail::Message, so including Mail::Internet and MIME::Entity
126 messages. It returns true when the transmission was successfully
127 completed.
128
129 -Option --Default
130 interval new(interval)
131 retry new(retry)
132 to undef
133
134 interval => SECONDS
135 retry => INTEGER
136 to => STRING
137 Overrules the destination(s) of the message, which is by default
138 taken from the (Resent-)To, (Resent-)Cc, and (Resent-)Bcc.
139
140 $obj->trySend(MESSAGE, OPTIONS)
141 Try to send the message. This will return true if successful, and
142 false in case some problems where detected. The $? contains the
143 exit status of the command which was started.
144
145 Server connection
146 $obj->findBinary(NAME [, DIRECTORIES])
147 See "Server connection" in Mail::Transport
148
149 $obj->remoteHost
150 See "Server connection" in Mail::Transport
151
152 $obj->retry
153 See "Server connection" in Mail::Transport
154
155 Error handling
156 $obj->AUTOLOAD
157 See "Error handling" in Mail::Reporter
158
159 $obj->addReport(OBJECT)
160 See "Error handling" in Mail::Reporter
161
162 $obj->defaultTrace([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])
163 Mail::Transport::Send->defaultTrace([LEVEL]|[LOGLEVEL,
164 TRACELEVEL]|[LEVEL, CALLBACK])
165
166 See "Error handling" in Mail::Reporter
167
168 $obj->errors
169 See "Error handling" in Mail::Reporter
170
171 $obj->log([LEVEL [,STRINGS]])
172 Mail::Transport::Send->log([LEVEL [,STRINGS]])
173
174 See "Error handling" in Mail::Reporter
175
176 $obj->logPriority(LEVEL)
177 Mail::Transport::Send->logPriority(LEVEL)
178
179 See "Error handling" in Mail::Reporter
180
181 $obj->logSettings
182 See "Error handling" in Mail::Reporter
183
184 $obj->notImplemented
185 See "Error handling" in Mail::Reporter
186
187 $obj->report([LEVEL])
188 See "Error handling" in Mail::Reporter
189
190 $obj->reportAll([LEVEL])
191 See "Error handling" in Mail::Reporter
192
193 $obj->trace([LEVEL])
194 See "Error handling" in Mail::Reporter
195
196 $obj->warnings
197 See "Error handling" in Mail::Reporter
198
199 Cleanup
200 $obj->DESTROY
201 See "Cleanup" in Mail::Reporter
202
203 $obj->inGlobalDestruction
204 See "Cleanup" in Mail::Reporter
205
207 Warning: Message has no destination
208 It was not possible to figure-out where the message is intended to
209 go to.
210
211 Error: Package $package does not implement $method.
212 Fatal error: the specific package (or one of its superclasses) does
213 not implement this method where it should. This message means that
214 some other related classes do implement this method however the
215 class at hand does not. Probably you should investigate this and
216 probably inform the author of the package.
217
218 Warning: Resent group does not specify a destination
219 The message which is sent is the result of a bounce (for instance
220 created with Mail::Message::bounce()), and therefore starts with a
221 "Received" header field. With the "bounce", the new destination(s)
222 of the message are given, which should be included as "Resent-To",
223 "Resent-Cc", and "Resent-Bcc".
224
225 The "To", "Cc", and "Bcc" header information is only used if no
226 "Received" was found. That seems to be the best explanation of the
227 RFC.
228
229 As alternative, you may also specify the "to" option to some of the
230 senders (for instance Mail::Transport::SMTP::send(to) to overrule
231 any information found in the message itself about the destination.
232
233 Error: Transporters of type $class cannot send.
234 The Mail::Transport object of the specified type can not send
235 messages, but only receive message.
236
238 This module is part of Mail-Box distribution version 2.097, built on
239 January 26, 2011. Website: http://perl.overmeer.net/mailbox/
240
242 Copyrights 2001-2011 by Mark Overmeer. For other contributors see
243 ChangeLog.
244
245 This program is free software; you can redistribute it and/or modify it
246 under the same terms as Perl itself. See
247 http://www.perl.com/perl/misc/Artistic.html
248
249
250
251perl v5.12.3 2011-01-26 Mail::Transport::Send(3)