1Mail::Transport::SMTP(3U)ser Contributed Perl DocumentatiMoanil::Transport::SMTP(3)
2
3
4

NAME

6       Mail::Transport::SMTP - transmit messages without external program
7

INHERITANCE

9        Mail::Transport::SMTP
10          is a Mail::Transport::Send
11          is a Mail::Transport
12          is a Mail::Reporter
13

SYNOPSIS

15        my $sender = Mail::Transport::SMTP->new(...);
16        $sender->send($message);
17
18        $message->send(via => 'smtp');
19

DESCRIPTION

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
26       warning: you may need to install Net::SMTPS, to get TLS support.
27
28       Extends "DESCRIPTION" in Mail::Transport::Send.
29

METHODS

31       Extends "METHODS" in Mail::Transport::Send.
32
33   Constructors
34       Extends "Constructors" in Mail::Transport::Send.
35
36       Mail::Transport::SMTP->new(%options)
37            -Option       --Defined in     --Default
38             esmtp_options                   {}
39             executable     Mail::Transport  undef
40             from                            undef
41             helo                            <from Net::Config>
42             hostname       Mail::Transport  <from Net::Config>
43             interval       Mail::Transport  30
44             log            Mail::Reporter   'WARNINGS'
45             password                        undef
46             port           Mail::Transport  25
47             proxy          Mail::Transport  <from Net::Config>
48             retry          Mail::Transport  <false>
49             smtp_debug                      <false>
50             timeout                         120
51             trace          Mail::Reporter   'WARNINGS'
52             username                        undef
53             via            Mail::Transport  'smtp'
54
55           esmtp_options => HASH
56             [2.116] ESMTP options to pass to Net::SMTP.  See the Net::SMTP
57             documentation for full details. Options can also be passed at
58             send time.  For example: "{ XVERP => 1 }"
59
60           executable => FILENAME
61           from => ADDRESS
62             Allows a default sender address to be specified globally.  See
63             trySend() for full details.
64
65           helo => HOST
66             The fully qualified name of the sender's host (your system) which
67             is used for the greeting message to the receiver.  If not
68             specified, Net::Config or else Net::Domain are questioned to find
69             it.  When even these do not supply a valid name, the name of the
70             domain in the "From" line of the message is assumed.
71
72           hostname => HOSTNAME|ARRAY
73           interval => SECONDS
74           log => LEVEL
75           password => STRING
76             The password to be used with the new(username) to log in to the
77             remote server.
78
79           port => INTEGER
80           proxy => PATH
81           retry => NUMBER|undef
82           smtp_debug => BOOLEAN
83             Simulate transmission: the SMTP protocol output will be sent to
84             your screen.
85
86           timeout => SECONDS
87             The number of seconds to wait for a valid response from the
88             server before failing.
89
90           trace => LEVEL
91           username => STRING
92             Use SASL authentication to contact the remote SMTP server
93             (RFC2554).  This username in combination with new(password) is
94             passed as arguments to Net::SMTP method auth.  Other forms of
95             authentication are not supported by Net::SMTP.  The "username"
96             can also be specified as an Authen::SASL object.
97
98           via => CLASS|NAME
99
100   Sending mail
101       Extends "Sending mail" in Mail::Transport::Send.
102
103       $obj->destinations( $message, [$address|ARRAY] )
104           Inherited, see "Sending mail" in Mail::Transport::Send
105
106       $obj->putContent($message, $fh, %options)
107           Inherited, see "Sending mail" in Mail::Transport::Send
108
109       $obj->send($message, %options)
110           Inherited, see "Sending mail" in Mail::Transport::Send
111
112       $obj->trySend($message, %options)
113           Try to send the $message once.   This may fail, in which case this
114           method will return "false".  In list context, the reason for
115           failure can be caught: in list context "trySend" will return a list
116           of six values:
117
118            (success, rc, rc-text, error location, quit success, accept)
119
120           Success and quit success are booleans.  The error code and -text
121           are protocol specific codes and texts.  The location tells where
122           the problem occurred.
123
124           [3.003] the 'accept' returns the message of the dataend()
125           instruction.  Some servers may provide useful information in there,
126           like an internal message registration id.  For example, postfix may
127           return "2.0.0 Ok: queued as 303EA380EE".  You can only use this
128           parameter when running local delivery (which is a smart choice
129           anyway)
130
131            -Option       --Default
132             esmtp_options  {}
133             from           < >
134             to             []
135
136           esmtp_options => HASH
137             Additional or overridden EMSTP options. See new(esmtp_options)
138
139           from => ADDRESS
140             Your own identification.  This may be fake.  If not specified, it
141             is taken from Mail::Message::sender(), which means the content of
142             the "Sender" field of the message or the first address of the
143             "From" field.  This defaults to "< >", which represents "no
144             address".
145
146           to => ADDRESS|[ADDRESSES]
147             Alternative destinations.  If not specified, the "To", "Cc" and
148             "Bcc" fields of the header are used.  An address is a string or a
149             Mail::Address object.
150
151   Server connection
152       Extends "Server connection" in Mail::Transport::Send.
153
154       $obj->contactAnyServer()
155           Creates the connection to the SMTP server.  When more than one
156           hostname was specified, the first which accepts a connection is
157           taken.  An IO::Socket::INET object is returned.
158
159       $obj->findBinary( $name, [@directories] )
160           Inherited, see "Server connection" in Mail::Transport
161
162       $obj->remoteHost()
163           Inherited, see "Server connection" in Mail::Transport
164
165       $obj->retry()
166           Inherited, see "Server connection" in Mail::Transport
167
168       $obj->tryConnectTo($host, %options)
169           Try to establish a connection to deliver SMTP to the specified
170           $host.  The %options are passed to the "new" method of Net::SMTP.
171
172   Error handling
173       Extends "Error handling" in Mail::Transport::Send.
174
175       $obj->AUTOLOAD()
176           Inherited, see "Error handling" in Mail::Reporter
177
178       $obj->addReport($object)
179           Inherited, see "Error handling" in Mail::Reporter
180
181       $obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level,
182       $callback] )
183       Mail::Transport::SMTP->defaultTrace( [$level]|[$loglevel,
184       $tracelevel]|[$level, $callback] )
185           Inherited, see "Error handling" in Mail::Reporter
186
187       $obj->errors()
188           Inherited, see "Error handling" in Mail::Reporter
189
190       $obj->log( [$level, [$strings]] )
191       Mail::Transport::SMTP->log( [$level, [$strings]] )
192           Inherited, see "Error handling" in Mail::Reporter
193
194       $obj->logPriority($level)
195       Mail::Transport::SMTP->logPriority($level)
196           Inherited, see "Error handling" in Mail::Reporter
197
198       $obj->logSettings()
199           Inherited, see "Error handling" in Mail::Reporter
200
201       $obj->notImplemented()
202           Inherited, see "Error handling" in Mail::Reporter
203
204       $obj->report( [$level] )
205           Inherited, see "Error handling" in Mail::Reporter
206
207       $obj->reportAll( [$level] )
208           Inherited, see "Error handling" in Mail::Reporter
209
210       $obj->trace( [$level] )
211           Inherited, see "Error handling" in Mail::Reporter
212
213       $obj->warnings()
214           Inherited, see "Error handling" in Mail::Reporter
215
216   Cleanup
217       Extends "Cleanup" in Mail::Transport::Send.
218
219       $obj->DESTROY()
220           Inherited, see "Cleanup" in Mail::Reporter
221

DIAGNOSTICS

223       Warning: Message has no destination
224           It was not possible to figure-out where the message is intended to
225           go to.
226
227       Notice: No addresses found to send the message to, no connection made
228       Error: Package $package does not implement $method.
229           Fatal error: the specific package (or one of its superclasses) does
230           not implement this method where it should. This message means that
231           some other related classes do implement this method however the
232           class at hand does not.  Probably you should investigate this and
233           probably inform the author of the package.
234
235       Warning: Resent group does not specify a destination
236           The message which is sent is the result of a bounce (for instance
237           created with Mail::Message::bounce()), and therefore starts with a
238           "Received" header field.  With the "bounce", the new destination(s)
239           of the message are given, which should be included as "Resent-To",
240           "Resent-Cc", and "Resent-Bcc".
241
242           The "To", "Cc", and "Bcc" header information is only used if no
243           "Received" was found.  That seems to be the best explanation of the
244           RFC.
245
246           As alternative, you may also specify the "to" option to some of the
247           senders (for instance Mail::Transport::SMTP::send(to) to overrule
248           any information found in the message itself about the destination.
249

SEE ALSO

251       This module is part of Mail-Transport distribution version 3.005, built
252       on July 22, 2020. Website: http://perl.overmeer.net/CPAN/
253

LICENSE

255       Copyrights 2001-2020 by [Mark Overmeer]. For other contributors see
256       ChangeLog.
257
258       This program is free software; you can redistribute it and/or modify it
259       under the same terms as Perl itself.  See http://dev.perl.org/licenses/
260
261
262
263perl v5.32.1                      2021-01-27          Mail::Transport::SMTP(3)
Impressum