Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "Net::SMTP 3" | |
132 | .TH Net::SMTP 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | Net::SMTP \- Simple Mail Transfer Protocol Client | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 1 | |
138 | \& use Net::SMTP; | |
139 | .Ve | |
140 | .PP | |
141 | .Vb 3 | |
142 | \& # Constructors | |
143 | \& $smtp = Net::SMTP->new('mailhost'); | |
144 | \& $smtp = Net::SMTP->new('mailhost', Timeout => 60); | |
145 | .Ve | |
146 | .SH "DESCRIPTION" | |
147 | .IX Header "DESCRIPTION" | |
148 | This module implements a client interface to the \s-1SMTP\s0 and \s-1ESMTP\s0 | |
149 | protocol, enabling a perl5 application to talk to \s-1SMTP\s0 servers. This | |
150 | documentation assumes that you are familiar with the concepts of the | |
151 | \&\s-1SMTP\s0 protocol described in \s-1RFC821\s0. | |
152 | .PP | |
153 | A new Net::SMTP object must be created with the \fInew\fR method. Once | |
154 | this has been done, all \s-1SMTP\s0 commands are accessed through this object. | |
155 | .PP | |
156 | The Net::SMTP class is a subclass of Net::Cmd and IO::Socket::INET. | |
157 | .SH "EXAMPLES" | |
158 | .IX Header "EXAMPLES" | |
159 | This example prints the mail domain name of the \s-1SMTP\s0 server known as mailhost: | |
160 | .PP | |
161 | .Vb 1 | |
162 | \& #!/usr/local/bin/perl -w | |
163 | .Ve | |
164 | .PP | |
165 | .Vb 1 | |
166 | \& use Net::SMTP; | |
167 | .Ve | |
168 | .PP | |
169 | .Vb 3 | |
170 | \& $smtp = Net::SMTP->new('mailhost'); | |
171 | \& print $smtp->domain,"\en"; | |
172 | \& $smtp->quit; | |
173 | .Ve | |
174 | .PP | |
175 | This example sends a small message to the postmaster at the \s-1SMTP\s0 server | |
176 | known as mailhost: | |
177 | .PP | |
178 | .Vb 1 | |
179 | \& #!/usr/local/bin/perl -w | |
180 | .Ve | |
181 | .PP | |
182 | .Vb 1 | |
183 | \& use Net::SMTP; | |
184 | .Ve | |
185 | .PP | |
186 | .Vb 1 | |
187 | \& $smtp = Net::SMTP->new('mailhost'); | |
188 | .Ve | |
189 | .PP | |
190 | .Vb 2 | |
191 | \& $smtp->mail($ENV{USER}); | |
192 | \& $smtp->to('postmaster'); | |
193 | .Ve | |
194 | .PP | |
195 | .Vb 5 | |
196 | \& $smtp->data(); | |
197 | \& $smtp->datasend("To: postmaster\en"); | |
198 | \& $smtp->datasend("\en"); | |
199 | \& $smtp->datasend("A simple test message\en"); | |
200 | \& $smtp->dataend(); | |
201 | .Ve | |
202 | .PP | |
203 | .Vb 1 | |
204 | \& $smtp->quit; | |
205 | .Ve | |
206 | .SH "CONSTRUCTOR" | |
207 | .IX Header "CONSTRUCTOR" | |
208 | .IP "new Net::SMTP [ \s-1HOST\s0, ] [ \s-1OPTIONS\s0 ]" 4 | |
209 | .IX Item "new Net::SMTP [ HOST, ] [ OPTIONS ]" | |
210 | This is the constructor for a new Net::SMTP object. \f(CW\*(C`HOST\*(C'\fR is the | |
211 | name of the remote host to which an \s-1SMTP\s0 connection is required. | |
212 | .Sp | |
213 | If \f(CW\*(C`HOST\*(C'\fR is not given, then the \f(CW\*(C`SMTP_Host\*(C'\fR specified in \f(CW\*(C`Net::Config\*(C'\fR | |
214 | will be used. | |
215 | .Sp | |
216 | \&\f(CW\*(C`OPTIONS\*(C'\fR are passed in a hash like fashion, using key and value pairs. | |
217 | Possible options are: | |
218 | .Sp | |
219 | \&\fBHello\fR \- \s-1SMTP\s0 requires that you identify yourself. This option | |
220 | specifies a string to pass as your mail domain. If not | |
221 | given a guess will be taken. | |
222 | .Sp | |
223 | \&\fBLocalAddr\fR and \fBLocalPort\fR \- These parameters are passed directly | |
224 | to IO::Socket to allow binding the socket to a local port. | |
225 | .Sp | |
226 | \&\fBTimeout\fR \- Maximum time, in seconds, to wait for a response from the | |
227 | \&\s-1SMTP\s0 server (default: 120) | |
228 | .Sp | |
229 | \&\fBDebug\fR \- Enable debugging information | |
230 | .Sp | |
231 | Example: | |
232 | .Sp | |
233 | .Vb 5 | |
234 | \& $smtp = Net::SMTP->new('mailhost', | |
235 | \& Hello => 'my.mail.domain' | |
236 | \& Timeout => 30, | |
237 | \& Debug => 1, | |
238 | \& ); | |
239 | .Ve | |
240 | .SH "METHODS" | |
241 | .IX Header "METHODS" | |
242 | Unless otherwise stated all methods return either a \fItrue\fR or \fIfalse\fR | |
243 | value, with \fItrue\fR meaning that the operation was a success. When a method | |
244 | states that it returns a value, failure will be returned as \fIundef\fR or an | |
245 | empty list. | |
246 | .IP "banner ()" 4 | |
247 | .IX Item "banner ()" | |
248 | Returns the banner message which the server replied with when the | |
249 | initial connection was made. | |
250 | .IP "domain ()" 4 | |
251 | .IX Item "domain ()" | |
252 | Returns the domain that the remote \s-1SMTP\s0 server identified itself as during | |
253 | connection. | |
254 | .IP "hello ( \s-1DOMAIN\s0 )" 4 | |
255 | .IX Item "hello ( DOMAIN )" | |
256 | Tell the remote server the mail domain which you are in using the \s-1EHLO\s0 | |
257 | command (or \s-1HELO\s0 if \s-1EHLO\s0 fails). Since this method is invoked | |
258 | automatically when the Net::SMTP object is constructed the user should | |
259 | normally not have to call it manually. | |
260 | .IP "etrn ( \s-1DOMAIN\s0 )" 4 | |
261 | .IX Item "etrn ( DOMAIN )" | |
262 | Request a queue run for the \s-1DOMAIN\s0 given. | |
263 | .IP "auth ( \s-1USERNAME\s0, \s-1PASSWORD\s0 )" 4 | |
264 | .IX Item "auth ( USERNAME, PASSWORD )" | |
265 | Attempt \s-1SASL\s0 authentication. | |
266 | .IP "mail ( \s-1ADDRESS\s0 [, \s-1OPTIONS\s0] )" 4 | |
267 | .IX Item "mail ( ADDRESS [, OPTIONS] )" | |
268 | .PD 0 | |
269 | .IP "send ( \s-1ADDRESS\s0 )" 4 | |
270 | .IX Item "send ( ADDRESS )" | |
271 | .IP "send_or_mail ( \s-1ADDRESS\s0 )" 4 | |
272 | .IX Item "send_or_mail ( ADDRESS )" | |
273 | .IP "send_and_mail ( \s-1ADDRESS\s0 )" 4 | |
274 | .IX Item "send_and_mail ( ADDRESS )" | |
275 | .PD | |
276 | Send the appropriate command to the server \s-1MAIL\s0, \s-1SEND\s0, \s-1SOML\s0 or \s-1SAML\s0. \f(CW\*(C`ADDRESS\*(C'\fR | |
277 | is the address of the sender. This initiates the sending of a message. The | |
278 | method \f(CW\*(C`recipient\*(C'\fR should be called for each address that the message is to | |
279 | be sent to. | |
280 | .Sp | |
281 | The \f(CW\*(C`mail\*(C'\fR method can some additional \s-1ESMTP\s0 \s-1OPTIONS\s0 which is passed | |
282 | in hash like fashion, using key and value pairs. Possible options are: | |
283 | .Sp | |
284 | .Vb 5 | |
285 | \& Size => <bytes> | |
286 | \& Return => <???> | |
287 | \& Bits => "7" | "8" | |
288 | \& Transaction => <ADDRESS> | |
289 | \& Envelope => <ENVID> | |
290 | .Ve | |
291 | .IP "reset ()" 4 | |
292 | .IX Item "reset ()" | |
293 | Reset the status of the server. This may be called after a message has been | |
294 | initiated, but before any data has been sent, to cancel the sending of the | |
295 | message. | |
296 | .IP "recipient ( \s-1ADDRESS\s0 [, \s-1ADDRESS\s0 [ ...]] [, \s-1OPTIONS\s0 ] )" 4 | |
297 | .IX Item "recipient ( ADDRESS [, ADDRESS [ ...]] [, OPTIONS ] )" | |
298 | Notify the server that the current message should be sent to all of the | |
299 | addresses given. Each address is sent as a separate command to the server. | |
300 | Should the sending of any address result in a failure then the | |
301 | process is aborted and a \fIfalse\fR value is returned. It is up to the | |
302 | user to call \f(CW\*(C`reset\*(C'\fR if they so desire. | |
303 | .Sp | |
304 | The \f(CW\*(C`recipient\*(C'\fR method can some additional \s-1OPTIONS\s0 which is passed | |
305 | in hash like fashion, using key and value pairs. Possible options are: | |
306 | .Sp | |
307 | .Vb 2 | |
308 | \& Notify => | |
309 | \& SkipBad => ignore bad addresses | |
310 | .Ve | |
311 | .Sp | |
312 | If \f(CW\*(C`SkipBad\*(C'\fR is true the \f(CW\*(C`recipient\*(C'\fR will not return an error when a | |
313 | bad address is encountered and it will return an array of addresses | |
314 | that did succeed. | |
315 | .Sp | |
316 | .Vb 3 | |
317 | \& $smtp->recipient($recipient1,$recipient2); # Good | |
318 | \& $smtp->recipient($recipient1,$recipient2, { SkipBad => 1 }); # Good | |
319 | \& $smtp->recipient("$recipient,$recipient2"); # BAD | |
320 | .Ve | |
321 | .IP "to ( \s-1ADDRESS\s0 [, \s-1ADDRESS\s0 [...]] )" 4 | |
322 | .IX Item "to ( ADDRESS [, ADDRESS [...]] )" | |
323 | .PD 0 | |
324 | .IP "cc ( \s-1ADDRESS\s0 [, \s-1ADDRESS\s0 [...]] )" 4 | |
325 | .IX Item "cc ( ADDRESS [, ADDRESS [...]] )" | |
326 | .IP "bcc ( \s-1ADDRESS\s0 [, \s-1ADDRESS\s0 [...]] )" 4 | |
327 | .IX Item "bcc ( ADDRESS [, ADDRESS [...]] )" | |
328 | .PD | |
329 | Synonyms for \f(CW\*(C`recipient\*(C'\fR. | |
330 | .IP "data ( [ \s-1DATA\s0 ] )" 4 | |
331 | .IX Item "data ( [ DATA ] )" | |
332 | Initiate the sending of the data from the current message. | |
333 | .Sp | |
334 | \&\f(CW\*(C`DATA\*(C'\fR may be a reference to a list or a list. If specified the contents | |
335 | of \f(CW\*(C`DATA\*(C'\fR and a termination string \f(CW".\er\en"\fR is sent to the server. And the | |
336 | result will be true if the data was accepted. | |
337 | .Sp | |
338 | If \f(CW\*(C`DATA\*(C'\fR is not specified then the result will indicate that the server | |
339 | wishes the data to be sent. The data must then be sent using the \f(CW\*(C`datasend\*(C'\fR | |
340 | and \f(CW\*(C`dataend\*(C'\fR methods described in Net::Cmd. | |
341 | .IP "expand ( \s-1ADDRESS\s0 )" 4 | |
342 | .IX Item "expand ( ADDRESS )" | |
343 | Request the server to expand the given address Returns an array | |
344 | which contains the text read from the server. | |
345 | .IP "verify ( \s-1ADDRESS\s0 )" 4 | |
346 | .IX Item "verify ( ADDRESS )" | |
347 | Verify that \f(CW\*(C`ADDRESS\*(C'\fR is a legitimate mailing address. | |
348 | .ie n .IP "help ( [ $subject ] )" 4 | |
349 | .el .IP "help ( [ \f(CW$subject\fR ] )" 4 | |
350 | .IX Item "help ( [ $subject ] )" | |
351 | Request help text from the server. Returns the text or undef upon failure | |
352 | .IP "quit ()" 4 | |
353 | .IX Item "quit ()" | |
354 | Send the \s-1QUIT\s0 command to the remote \s-1SMTP\s0 server and close the socket connection. | |
355 | .SH "ADDRESSES" | |
356 | .IX Header "ADDRESSES" | |
357 | All methods that accept addresses expect the address to be a valid rfc2821\-quoted address, although | |
358 | Net::SMTP will accept accept the address surrounded by angle brackets. | |
359 | .PP | |
360 | .Vb 3 | |
361 | \& funny user@domain WRONG | |
362 | \& "funny user"@domain RIGHT, recommended | |
363 | \& <"funny user"@domain> OK | |
364 | .Ve | |
365 | .SH "SEE ALSO" | |
366 | .IX Header "SEE ALSO" | |
367 | Net::Cmd | |
368 | .SH "AUTHOR" | |
369 | .IX Header "AUTHOR" | |
370 | Graham Barr <gbarr@pobox.com> | |
371 | .SH "COPYRIGHT" | |
372 | .IX Header "COPYRIGHT" | |
373 | Copyright (c) 1995\-1997 Graham Barr. All rights reserved. | |
374 | This program is free software; you can redistribute it and/or modify | |
375 | it under the same terms as Perl itself. | |
376 | .PP | |
377 | \&\fI$Id: //depot/libnet/Net/SMTP.pm#25 $\fR |