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