1Mail::Transport(3) User Contributed Perl Documentation Mail::Transport(3)
2
3
4
6 Mail::Transport - use Mail Transfer Agents (MTAs)
7
9 Mail::Transport
10 is a Mail::Reporter
11
12 Mail::Transport is extended by
13 Mail::Transport::Receive
14 Mail::Transport::Send
15
17 my $message = Mail::Message->new(...);
18
19 # Some extensions implement sending:
20 $message->send;
21 $message->send(via => 'sendmail');
22
23 my $sender = Mail::Transport::SMTP->new(...);
24 $sender->send($message);
25
26 # Some extensions implement receiving:
27 my $receiver = Mail::Transport::POP3->new(...);
28 $message = $receiver->receive;
29
31 Objects which extend "Mail::Transport" implement sending and/or
32 receiving of messages, using various protocols.
33
34 Mail::Transport::Send extends this class, and offers general
35 functionality for send protocols, like SMTP. Mail::Transport::Receive
36 also extends this class, and offers receive method. Some transport
37 protocols will implement both sending and receiving.
38
39 Extends "DESCRIPTION" in Mail::Reporter.
40
42 Extends "METHODS" in Mail::Reporter.
43
44 Constructors
45 Extends "Constructors" in Mail::Reporter.
46
47 Mail::Transport->new(%options)
48 -Option --Defined in --Default
49 executable undef
50 hostname 'localhost'
51 interval 30
52 log Mail::Reporter 'WARNINGS'
53 password undef
54 port undef
55 proxy undef
56 retry <false>
57 timeout 120
58 trace Mail::Reporter 'WARNINGS'
59 username undef
60 via 'sendmail'
61
62 executable => FILENAME
63 If you specify an executable, the module does not need to search
64 the system directories to figure-out where the client lives.
65 Using this decreases the flexible usage of your program: moving
66 your program to other systems may involve changing the path to
67 the executable, which otherwise would work auto-detect and
68 unmodified.
69
70 hostname => HOSTNAME|ARRAY
71 The host on which the server runs. Some protocols accept an
72 ARRAY of alternatives for this option.
73
74 interval => SECONDS
75 The time between tries to contact the remote server for sending
76 or receiving a message in SECONDS. This number must be larger
77 than 0.
78
79 log => LEVEL
80 password => STRING
81 Some protocols require a password to be given, usually in
82 combination with a password.
83
84 port => INTEGER
85 The port number behind which the service is hiding on the remote
86 server.
87
88 proxy => PATH
89 The name of the proxy software (the protocol handler). This must
90 be the name (preferable the absolute path) of your mail delivery
91 software.
92
93 retry => NUMBER|undef
94 The number of retries before the sending will fail. If "undef",
95 the number of retries is unlimited.
96
97 timeout => SECONDS
98 SECONDS till time-out while establishing the connection to a
99 remote server.
100
101 trace => LEVEL
102 username => STRING
103 Some protocols require a user to login.
104
105 via => CLASS|NAME
106 Which CLASS (extending "Mail::Transport") will transport the
107 data. Some predefined NAMEs avoid long class names: "mail" and
108 "mailx" are handled by the Mail::Transport::Mailx module,
109 "sendmail" and "postfix" belong to Mail::Transport::Sendmail, and
110 "smtp" is implemented in Mail::Transport::SMTP.
111
112 The "pop" or "pop3" protocol implementation can be found
113 distribution Mail::Transport::POP3. For "imap" or "imap4",
114 install Mail::Transport::IMAP4.
115
116 Server connection
117 $obj->findBinary( $name, [@directories] )
118 Look for a binary with the specified $name in the directories which
119 are defined to be safe. The list of standard directories is
120 followed by the optional @directories. The full pathname is
121 returned.
122
123 You may specify new(proxy), which specifies the absolute name of
124 the binary to be used.
125
126 $obj->remoteHost()
127 Returns the hostname, port number, username and password to be used
128 to establish the connection to the server for sending or receiving
129 mail.
130
131 $obj->retry()
132 Returns the retry interval, retry count, and timeout for the
133 connection.
134
135 Error handling
136 Extends "Error handling" in Mail::Reporter.
137
138 $obj->AUTOLOAD()
139 Inherited, see "Error handling" in Mail::Reporter
140
141 $obj->addReport($object)
142 Inherited, see "Error handling" in Mail::Reporter
143
144 $obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level,
145 $callback] )
146 Mail::Transport->defaultTrace( [$level]|[$loglevel,
147 $tracelevel]|[$level, $callback] )
148 Inherited, see "Error handling" in Mail::Reporter
149
150 $obj->errors()
151 Inherited, see "Error handling" in Mail::Reporter
152
153 $obj->log( [$level, [$strings]] )
154 Mail::Transport->log( [$level, [$strings]] )
155 Inherited, see "Error handling" in Mail::Reporter
156
157 $obj->logPriority($level)
158 Mail::Transport->logPriority($level)
159 Inherited, see "Error handling" in Mail::Reporter
160
161 $obj->logSettings()
162 Inherited, see "Error handling" in Mail::Reporter
163
164 $obj->notImplemented()
165 Inherited, see "Error handling" in Mail::Reporter
166
167 $obj->report( [$level] )
168 Inherited, see "Error handling" in Mail::Reporter
169
170 $obj->reportAll( [$level] )
171 Inherited, see "Error handling" in Mail::Reporter
172
173 $obj->trace( [$level] )
174 Inherited, see "Error handling" in Mail::Reporter
175
176 $obj->warnings()
177 Inherited, see "Error handling" in Mail::Reporter
178
179 Cleanup
180 Extends "Cleanup" in Mail::Reporter.
181
182 $obj->DESTROY()
183 Inherited, see "Cleanup" in Mail::Reporter
184
186 Warning: Avoid program abuse: specify an absolute path for $exec.
187 Specifying explicit locations for executables of email transfer
188 agents should only be done with absolute file names, to avoid
189 various pontential security problems.
190
191 Warning: Executable $exec does not exist.
192 The explicitly indicated mail transfer agent does not exists. The
193 normal settings are used to find the correct location.
194
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
203 This module is part of Mail-Transport distribution version 3.005, built
204 on July 22, 2020. Website: http://perl.overmeer.net/CPAN/
205
207 Copyrights 2001-2020 by [Mark Overmeer]. For other contributors see
208 ChangeLog.
209
210 This program is free software; you can redistribute it and/or modify it
211 under the same terms as Perl itself. See http://dev.perl.org/licenses/
212
213
214
215perl v5.38.0 2023-07-20 Mail::Transport(3)