1Mail::Transport(3) User Contributed Perl Documentation Mail::Transport(3)
2
3
4
6 Mail::Transport - base class for message exchange
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 receiv‐
32 ing of messages, using various protocols.
33
34 Mail::Transport::Send extends this class, and offers general function‐
35 ality for send protocols, like SMTP. Mail::Transport::Receive also
36 extends this class, and offers receive method. Some transport proto‐
37 cols will implement both sending and receiving.
38
40 Constructors
41
42 Mail::Transport->new(OPTIONS)
43
44 Option --Defined in --Default
45 executable undef
46 hostname 'localhost'
47 interval 30
48 log Mail::Reporter 'WARNINGS'
49 password undef
50 port undef
51 proxy undef
52 retry <false>
53 timeout 120
54 trace Mail::Reporter 'WARNINGS'
55 username undef
56 via 'sendmail'
57
58 . executable FILENAME
59
60 If you specify an executable, the module does not need to
61 search the system directories to figure-out where the client
62 lives. Using this decreases the flexible usage of your pro‐
63 gram: moving your program to other systems may involve changing
64 the path to the executable, which otherwise would work auto-
65 detect and unmodified.
66
67 . hostname HOSTNAME⎪ARRAY-OF-HOSTNAMES
68
69 The host on which the server runs. Some protocols accept an
70 array of alternatives for this option.
71
72 . interval SECONDS
73
74 The time between tries to contact the remote server for sending
75 or receiving a message in SECONDS. This number must be larger
76 than 0.
77
78 . log LEVEL
79
80 . password STRING
81
82 Some protocols require a password to be given, usually in com‐
83 bination with a password.
84
85 . port INTEGER
86
87 The port number behind which the service is hiding on the
88 remote server.
89
90 . proxy PATH
91
92 The name of the proxy software (the protocol handler). This
93 must be the name (preferable the absolute path) of your mail
94 delivery software.
95
96 . retry NUMBER⎪undef
97
98 The number of retries before the sending will fail. If
99 "undef", the number of retries is unlimited.
100
101 . timeout SECONDS
102
103 SECONDS till time-out while establishing the connection to a
104 remote server.
105
106 . trace LEVEL
107
108 . username STRING
109
110 Some protocols require a user to login.
111
112 . via CLASS⎪NAME
113
114 Which CLASS (extending "Mail::Transport") will transport the
115 data. Some predefined NAMEs avoid long class names: "mail" and
116 "mailx" are handled by the Mail::Transport::Mailx module,
117 "sendmail" and "postfix" belong to Mail::Transport::Sendmail,
118 and "smtp" is implemented in Mail::Transport::SMTP. The "pop"
119 or "pop3" protocol implementation can be found in Mail::Trans‐
120 port::POP3.
121
122 Server connection
123
124 $obj->findBinary(NAME [, DIRECTORIES])
125
126 Look for a binary with the specified NAME in the directories which
127 are defined to be safe. The list of standard directories is fol‐
128 lowed by the optional DIRECTORIES. The full pathname is returned.
129
130 You may specify new(proxy), which specifies the absolute name of
131 the binary to be used.
132
133 $obj->remoteHost
134
135 Returns the hostname, port number, username and password to be used
136 to establish the connection to the server for sending or receiving
137 mail.
138
139 $obj->retry
140
141 Returns the retry interval, retry count, and timeout for the con‐
142 nection.
143
144 Error handling
145
146 $obj->AUTOLOAD
147
148 See "Error handling" in Mail::Reporter
149
150 $obj->addReport(OBJECT)
151
152 See "Error handling" in Mail::Reporter
153
154 $obj->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL, CALLBACK])
155
156 Mail::Transport->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL,
157 CALLBACK])
158
159 See "Error handling" in Mail::Reporter
160
161 $obj->errors
162
163 See "Error handling" in Mail::Reporter
164
165 $obj->log([LEVEL [,STRINGS]])
166
167 Mail::Transport->log([LEVEL [,STRINGS]])
168
169 See "Error handling" in Mail::Reporter
170
171 $obj->logPriority(LEVEL)
172
173 Mail::Transport->logPriority(LEVEL)
174
175 See "Error handling" in Mail::Reporter
176
177 $obj->logSettings
178
179 See "Error handling" in Mail::Reporter
180
181 $obj->notImplemented
182
183 See "Error handling" in Mail::Reporter
184
185 $obj->report([LEVEL])
186
187 See "Error handling" in Mail::Reporter
188
189 $obj->reportAll([LEVEL])
190
191 See "Error handling" in Mail::Reporter
192
193 $obj->trace([LEVEL])
194
195 See "Error handling" in Mail::Reporter
196
197 $obj->warnings
198
199 See "Error handling" in Mail::Reporter
200
201 Cleanup
202
203 $obj->DESTROY
204
205 See "Cleanup" in Mail::Reporter
206
207 $obj->inGlobalDestruction
208
209 See "Cleanup" in Mail::Reporter
210
212 Warning: Avoid program abuse: specify an absolute path for $exec.
213
214 Specifying explicit locations for executables of email transfer agents
215 should only be done with absolute file names, to avoid various pon‐
216 tential security problems.
217
218 Warning: Executable $exec does not exist.
219
220 The explicitly indicated mail transfer agent does not exists. The nor‐
221 mal settings are used to find the correct location.
222
223 Error: Package $package does not implement $method.
224
225 Fatal error: the specific package (or one of its superclasses) does not
226 implement this method where it should. This message means that some
227 other related classes do implement this method however the class at
228 hand does not. Probably you should investigate this and probably
229 inform the author of the package.
230
232 This module is part of Mail-Box distribution version 2.070, built on
233 March 25, 2007. Website: http://perl.overmeer.net/mailbox/
234
236 Copyrights 2001-2007 by Mark Overmeer.For other contributors see
237 ChangeLog.
238
239 This program is free software; you can redistribute it and/or modify it
240 under the same terms as Perl itself. See
241 http://www.perl.com/perl/misc/Artistic.html
242
243
244
245perl v5.8.8 2007-03-25 Mail::Transport(3)