1Mail::Transport::SMTP(3U)ser Contributed Perl DocumentatiMoanil::Transport::SMTP(3)
2
3
4
6 Mail::Transport::SMTP - transmit messages without external program
7
9 Mail::Transport::SMTP
10 is a Mail::Transport::Send
11 is a Mail::Transport
12 is a Mail::Reporter
13
15 my $sender = Mail::Transport::SMTP->new(...);
16 $sender->send($message);
17
18 $message->send(via => 'smtp');
19
21 This module implements transport of "Mail::Message" objects by negoti‐
22 ating to the destination host directly by using the SMTP protocol,
23 without help of "sendmail", "mail", or other programs on the local
24 host.
25
27 Constructors
28
29 Mail::Transport::SMTP->new(OPTIONS)
30
31 Option --Defined in --Default
32 executable Mail::Transport undef
33 helo <from Net::Config>
34 hostname Mail::Transport <from Net::Config>
35 interval Mail::Transport 30
36 log Mail::Reporter 'WARNINGS'
37 password undef
38 port Mail::Transport 25
39 proxy Mail::Transport <from Net::Config>
40 retry Mail::Transport <false>
41 smtp_debug <false>
42 timeout 120
43 trace Mail::Reporter 'WARNINGS'
44 username undef
45 via Mail::Transport 'smtp'
46
47 . executable FILENAME
48
49 . helo HOST
50
51 The fully qualified name of the sender's host (your system)
52 which is used for the greeting message to the receiver. If not
53 specified, Net::Config or else Net::Domain are questioned to
54 find it. When even these do not supply a valid name, the name
55 of the domain in the "From" line of the message is assumed.
56
57 . hostname HOSTNAME⎪ARRAY-OF-HOSTNAMES
58
59 . interval SECONDS
60
61 . log LEVEL
62
63 . password STRING
64
65 The password to be used with the new(username) to log in to the
66 remote server.
67
68 . port INTEGER
69
70 . proxy PATH
71
72 . retry NUMBER⎪undef
73
74 . smtp_debug BOOLEAN
75
76 Simulate transmission: the SMTP protocol output will be sent to
77 your screen.
78
79 . timeout SECONDS
80
81 The number of seconds to wait for a valid response from the
82 server before failing.
83
84 . trace LEVEL
85
86 . username STRING
87
88 Use SASL authentication to contact the remote SMTP server
89 (RFC2554). This username in combination with new(password) is
90 passed as arguments to Net::SMTP method auth. Other forms of
91 authentication are not supported by Net::SMTP. The "username"
92 can also be specified as an Authen::SASL object.
93
94 . via CLASS⎪NAME
95
96 Sending mail
97
98 $obj->destinations(MESSAGE, [ADDRESS⎪ARRAY-OF-ADDRESSES])
99
100 See "Sending mail" in Mail::Transport::Send
101
102 $obj->putContent(MESSAGE, FILEHANDLE, OPTIONS)
103
104 See "Sending mail" in Mail::Transport::Send
105
106 $obj->send(MESSAGE, OPTIONS)
107
108 See "Sending mail" in Mail::Transport::Send
109
110 $obj->trySend(MESSAGE, OPTIONS)
111
112 Try to send the MESSAGE once. This may fail, in which case this
113 method will return "false". In list context, the reason for fail‐
114 ure can be caught: in list context "trySend" will return a list of
115 five values:
116
117 (success, error code, error text, error location, quit success)
118
119 Success and quit success are booleans. The error code and -text
120 are protocol specific codes and texts. The location tells where
121 the problem occurred.
122
123 Option--Default
124 from < >
125 to []
126
127 . from ADDRESS
128
129 Your own identification. This may be fake. If not specified,
130 it is taken from Mail::Message::sender(), which means the con‐
131 tent of the "Sender" field of the message or the first address
132 of the "From" field. This defaults to "< >", which represents
133 "no address".
134
135 . to ADDRESS⎪[ADDRESSES]
136
137 Alternative destinations. If not specified, the "To", "Cc" and
138 "Bcc" fields of the header are used. An address is a string or
139 a Mail::Address object.
140
141 Server connection
142
143 $obj->contactAnyServer
144
145 Creates the connection to the SMTP server. When more than one
146 hostname was specified, the first which accepts a connection is
147 taken. An IO::Socket::INET object is returned.
148
149 $obj->findBinary(NAME [, DIRECTORIES])
150
151 See "Server connection" in Mail::Transport
152
153 $obj->remoteHost
154
155 See "Server connection" in Mail::Transport
156
157 $obj->retry
158
159 See "Server connection" in Mail::Transport
160
161 $obj->tryConnectTo(HOST, OPTIONS)
162
163 Try to establish a connection to deliver SMTP to the specified
164 HOST. The OPTIONS are passed to the "new" method of Net::SMTP.
165
166 Error handling
167
168 $obj->AUTOLOAD
169
170 See "Error handling" in Mail::Reporter
171
172 $obj->addReport(OBJECT)
173
174 See "Error handling" in Mail::Reporter
175
176 $obj->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL, CALLBACK])
177
178 Mail::Transport::SMTP->defaultTrace([LEVEL]⎪[LOGLEVEL,
179 TRACELEVEL]⎪[LEVEL, CALLBACK])
180
181 See "Error handling" in Mail::Reporter
182
183 $obj->errors
184
185 See "Error handling" in Mail::Reporter
186
187 $obj->log([LEVEL [,STRINGS]])
188
189 Mail::Transport::SMTP->log([LEVEL [,STRINGS]])
190
191 See "Error handling" in Mail::Reporter
192
193 $obj->logPriority(LEVEL)
194
195 Mail::Transport::SMTP->logPriority(LEVEL)
196
197 See "Error handling" in Mail::Reporter
198
199 $obj->logSettings
200
201 See "Error handling" in Mail::Reporter
202
203 $obj->notImplemented
204
205 See "Error handling" in Mail::Reporter
206
207 $obj->report([LEVEL])
208
209 See "Error handling" in Mail::Reporter
210
211 $obj->reportAll([LEVEL])
212
213 See "Error handling" in Mail::Reporter
214
215 $obj->trace([LEVEL])
216
217 See "Error handling" in Mail::Reporter
218
219 $obj->warnings
220
221 See "Error handling" in Mail::Reporter
222
223 Cleanup
224
225 $obj->DESTROY
226
227 See "Cleanup" in Mail::Reporter
228
229 $obj->inGlobalDestruction
230
231 See "Cleanup" in Mail::Reporter
232
234 Warning: Message has no destination
235
236 It was not possible to figure-out where the message is intended to go
237 to.
238
239 Notice: No addresses found to send the message to, no connection made
240
241 Error: Package $package does not implement $method.
242
243 Fatal error: the specific package (or one of its superclasses) does not
244 implement this method where it should. This message means that some
245 other related classes do implement this method however the class at
246 hand does not. Probably you should investigate this and probably
247 inform the author of the package.
248
249 Warning: Resent group does not specify a destination
250
251 The message which is sent is the result of a bounce (for instance cre‐
252 ated with Mail::Message::bounce()), and therefore starts with a
253 "Received" header field. With the "bounce", the new destination(s) of
254 the message are given, which should be included as "Resent-To",
255 "Resent-Cc", and "Resent-Bcc".
256
257 The "To", "Cc", and "Bcc" header information is only used if no
258 "Received" was found. That seems to be the best explanation of the
259 RFC.
260
261 As alternative, you may also specify the "to" option to some of the
262 senders (for instance Mail::Transport::SMTP::send(to) to overrule any
263 information found in the message itself about the destination.
264
266 This module is part of Mail-Box distribution version 2.070, built on
267 March 25, 2007. Website: http://perl.overmeer.net/mailbox/
268
270 Copyrights 2001-2007 by Mark Overmeer.For other contributors see
271 ChangeLog.
272
273 This program is free software; you can redistribute it and/or modify it
274 under the same terms as Perl itself. See
275 http://www.perl.com/perl/misc/Artistic.html
276
277
278
279perl v5.8.8 2007-03-25 Mail::Transport::SMTP(3)