1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
5 <!-- template designed by Marco Von Ballmoos -->
6 <title>Docs For Class SMTP</title>
7 <link rel="stylesheet" href="../media/stylesheet.css" />
8 <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
11 <div class="page-body">
12 <h2 class="class-name">Class SMTP</h2>
14 <a name="sec-description"></a>
15 <div class="info-box">
16 <div class="info-box-title">Description</div>
18 <span class="disabled">Description</span> |
19 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
20 | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
23 <div class="info-box-body">
24 <!-- ========== Info from phpDoc block ========= -->
25 <p class="short-description">SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server.</p>
27 <li><span class="field">author:</span> <p>Chris Ryan</p></li>
30 Located in <a class="field" href="_class_smtp_php.html">Program_Root/class.smtp.php</a> (line <span class="field">24</span>)
40 <a name="sec-var-summary"></a>
41 <div class="info-box">
42 <div class="info-box-title">Variable Summary</span></div>
44 <a href="#sec-description">Description</a> |
45 <span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
47 <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
50 <div class="info-box-body">
51 <div class="var-summary">
52 <div class="var-title">
53 <span class="var-type">string</span>
54 <a href="#$CRLF" title="details" class="var-name">$CRLF</a>
56 <div class="var-title">
57 <span class="var-type">bool</span>
58 <a href="#$do_debug" title="details" class="var-name">$do_debug</a>
60 <div class="var-title">
61 <span class="var-type">int</span>
62 <a href="#$SMTP_PORT" title="details" class="var-name">$SMTP_PORT</a>
68 <a name="sec-method-summary"></a>
69 <div class="info-box">
70 <div class="info-box-title">Method Summary</span></div>
72 <a href="#sec-description">Description</a> |
73 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
76 <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
78 <div class="info-box-body">
79 <div class="method-summary">
81 <div class="method-definition">
82 <span class="method-result">void</span>
83 <a href="#SMTP" title="details" class="method-name">SMTP</a>
87 <div class="method-definition">
88 <span class="method-result">bool</span>
89 <a href="#Authenticate" title="details" class="method-name">Authenticate</a>
90 (<span class="var-type">mixed</span> <span class="var-name">$username</span>, <span class="var-type">mixed</span> <span class="var-name">$password</span>)
93 <div class="method-definition">
94 <span class="method-result">void</span>
95 <a href="#Close" title="details" class="method-name">Close</a>
99 <div class="method-definition">
100 <span class="method-result">bool</span>
101 <a href="#Connect" title="details" class="method-name">Connect</a>
102 (<span class="var-type">mixed</span> <span class="var-name">$host</span>, <span class="var-type">mixed</span> <span class="var-name">$port</span>, [<span class="var-type">mixed</span> <span class="var-name">$tval</span> = <span class="var-default">30</span>])
105 <div class="method-definition">
106 <span class="method-result">bool</span>
107 <a href="#Data" title="details" class="method-name">Data</a>
108 (<span class="var-type">mixed</span> <span class="var-name">$msg_data</span>)
111 <div class="method-definition">
112 <span class="method-result">string</span>
113 <a href="#Expand" title="details" class="method-name">Expand</a>
114 (<span class="var-type">mixed</span> <span class="var-name">$name</span>)
117 <div class="method-definition">
118 <span class="method-result">bool</span>
119 <a href="#Hello" title="details" class="method-name">Hello</a>
120 ([<span class="var-type">mixed</span> <span class="var-name">$host</span> = <span class="var-default">""</span>])
123 <div class="method-definition">
124 <span class="method-result">string</span>
125 <a href="#Help" title="details" class="method-name">Help</a>
126 ([<span class="var-type">mixed</span> <span class="var-name">$keyword</span> = <span class="var-default">""</span>])
129 <div class="method-definition">
130 <span class="method-result">bool</span>
131 <a href="#Mail" title="details" class="method-name">Mail</a>
132 (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
135 <div class="method-definition">
136 <span class="method-result">bool</span>
137 <a href="#Noop" title="details" class="method-name">Noop</a>
141 <div class="method-definition">
142 <span class="method-result">bool</span>
143 <a href="#Quit" title="details" class="method-name">Quit</a>
144 ([<span class="var-type">mixed</span> <span class="var-name">$close_on_error</span> = <span class="var-default">true</span>])
147 <div class="method-definition">
148 <span class="method-result">bool</span>
149 <a href="#Recipient" title="details" class="method-name">Recipient</a>
150 (<span class="var-type">mixed</span> <span class="var-name">$to</span>)
153 <div class="method-definition">
154 <span class="method-result">bool</span>
155 <a href="#Reset" title="details" class="method-name">Reset</a>
159 <div class="method-definition">
160 <span class="method-result">bool</span>
161 <a href="#Send" title="details" class="method-name">Send</a>
162 (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
165 <div class="method-definition">
166 <span class="method-result">bool</span>
167 <a href="#SendAndMail" title="details" class="method-name">SendAndMail</a>
168 (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
171 <div class="method-definition">
172 <span class="method-result">bool</span>
173 <a href="#SendOrMail" title="details" class="method-name">SendOrMail</a>
174 (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
177 <div class="method-definition">
178 <span class="method-result">bool</span>
179 <a href="#Turn" title="details" class="method-name">Turn</a>
183 <div class="method-definition">
184 <span class="method-result">int</span>
185 <a href="#Verify" title="details" class="method-name">Verify</a>
186 (<span class="var-type">mixed</span> <span class="var-name">$name</span>)
192 <a name="sec-vars"></a>
193 <div class="info-box">
194 <div class="info-box-title">Variables</div>
195 <div class="nav-bar">
196 <a href="#sec-description">Description</a> |
197 <a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
201 <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
204 <div class="info-box-body">
205 <a name="var$CRLF" id="$CRLF"><!-- --></A>
208 <div class="var-header">
209 <span class="var-title">
210 <span class="var-type">string</span>
211 <span class="var-name">$CRLF</span>
212 = <span class="var-default"> "\r\n"</span> (line <span class="line-number">36</span>)
216 <!-- ========== Info from phpDoc block ========= -->
217 <p class="short-description">SMTP reply line ending</p>
224 <a name="var$do_debug" id="$do_debug"><!-- --></A>
225 <div class="evenrow">
227 <div class="var-header">
228 <span class="var-title">
229 <span class="var-type">bool</span>
230 <span class="var-name">$do_debug</span>
231 (line <span class="line-number">42</span>)
235 <!-- ========== Info from phpDoc block ========= -->
236 <p class="short-description">Sets whether debugging is turned on</p>
243 <a name="var$SMTP_PORT" id="$SMTP_PORT"><!-- --></A>
246 <div class="var-header">
247 <span class="var-title">
248 <span class="var-type">int</span>
249 <span class="var-name">$SMTP_PORT</span>
250 = <span class="var-default"> 25</span> (line <span class="line-number">30</span>)
254 <!-- ========== Info from phpDoc block ========= -->
255 <p class="short-description">SMTP server port</p>
266 <a name="sec-methods"></a>
267 <div class="info-box">
268 <div class="info-box-title">Methods</div>
269 <div class="nav-bar">
270 <a href="#sec-description">Description</a> |
271 <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
272 <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
275 <div class="info-box-body">
276 <A NAME='method_detail'></A>
277 <a name="methodSMTP" id="SMTP"><!-- --></a>
278 <div class="evenrow">
280 <div class="method-header">
281 <span class="method-title">Constructor SMTP</span> (line <span class="line-number">57</span>)
284 <!-- ========== Info from phpDoc block ========= -->
285 <p class="short-description">Initialize the class so that the data is in a known state.</p>
287 <li><span class="field">access:</span> public</li>
290 <div class="method-signature">
291 <span class="method-result">void</span>
292 <span class="method-name">
301 <a name="methodAuthenticate" id="Authenticate"><!-- --></a>
304 <div class="method-header">
305 <span class="method-title">Authenticate</span> (line <span class="line-number">144</span>)
308 <!-- ========== Info from phpDoc block ========= -->
309 <p class="short-description">Performs SMTP authentication. Must be run after running the Hello() method. Returns true if successfully authenticated.</p>
311 <li><span class="field">access:</span> public</li>
314 <div class="method-signature">
315 <span class="method-result">bool</span>
316 <span class="method-name">
319 (<span class="var-type">mixed</span> <span class="var-name">$username</span>, <span class="var-type">mixed</span> <span class="var-name">$password</span>)
325 <a name="methodClose" id="Close"><!-- --></a>
326 <div class="evenrow">
328 <div class="method-header">
329 <span class="method-title">Close</span> (line <span class="line-number">232</span>)
332 <!-- ========== Info from phpDoc block ========= -->
333 <p class="short-description">Closes the socket and cleans up the state of the class.</p>
334 <p class="description"><p>It is not considered good to use this function without first trying to use QUIT.</p></p>
336 <li><span class="field">access:</span> public</li>
339 <div class="method-signature">
340 <span class="method-result">void</span>
341 <span class="method-name">
350 <a name="methodConnect" id="Connect"><!-- --></a>
353 <div class="method-header">
354 <span class="method-title">Connect</span> (line <span class="line-number">82</span>)
357 <!-- ========== Info from phpDoc block ========= -->
358 <p class="short-description">Connect to the server specified on the port specified.</p>
359 <p class="description"><p>If the port is not specified use the default SMTP_PORT. If tval is specified then a connection will try and be established with the server for that number of seconds. If tval is not specified the default is 30 seconds to try on the connection.</p><p>SMTP CODE SUCCESS: 220 SMTP CODE FAILURE: 421</p></p>
361 <li><span class="field">access:</span> public</li>
364 <div class="method-signature">
365 <span class="method-result">bool</span>
366 <span class="method-name">
369 (<span class="var-type">mixed</span> <span class="var-name">$host</span>, <span class="var-type">mixed</span> <span class="var-name">$port</span>, [<span class="var-type">mixed</span> <span class="var-name">$tval</span> = <span class="var-default">30</span>])
375 <a name="methodData" id="Data"><!-- --></a>
376 <div class="evenrow">
378 <div class="method-header">
379 <span class="method-title">Data</span> (line <span class="line-number">266</span>)
382 <!-- ========== Info from phpDoc block ========= -->
383 <p class="short-description">Issues a data command and sends the msg_data to the server</p>
384 <p class="description"><p>finializing the mail transaction. $msg_data is the message that is to be send with the headers. Each header needs to be on a single line followed by a <CRLF> with the message headers and the message body being seperated by and additional <CRLF>.</p><p>Implements rfc 821: DATA <CRLF></p><p>SMTP CODE INTERMEDIATE: 354 [data] <CRLF>.<CRLF> SMTP CODE SUCCESS: 250 SMTP CODE FAILURE: 552,554,451,452 SMTP CODE FAILURE: 451,554 SMTP CODE ERROR : 500,501,503,421</p></p>
386 <li><span class="field">access:</span> public</li>
389 <div class="method-signature">
390 <span class="method-result">bool</span>
391 <span class="method-name">
394 (<span class="var-type">mixed</span> <span class="var-name">$msg_data</span>)
400 <a name="methodExpand" id="Expand"><!-- --></a>
403 <div class="method-header">
404 <span class="method-title">Expand</span> (line <span class="line-number">399</span>)
407 <!-- ========== Info from phpDoc block ========= -->
408 <p class="short-description">Expand takes the name and asks the server to list all the people who are members of the _list_. Expand will return back and array of the result or false if an error occurs.</p>
409 <p class="description"><p>Each value in the array returned has the format of: [ <full-name> <sp> ] <path> The definition of <path> is defined in rfc 821</p><p>Implements rfc 821: EXPN <SP> <string> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE FAILURE: 550 SMTP CODE ERROR : 500,501,502,504,421</p></p>
411 <li><span class="field">return:</span> <p>array</p></li>
412 <li><span class="field">access:</span> public</li>
415 <div class="method-signature">
416 <span class="method-result">string</span>
417 <span class="method-name">
420 (<span class="var-type">mixed</span> <span class="var-name">$name</span>)
426 <a name="methodHello" id="Hello"><!-- --></a>
427 <div class="evenrow">
429 <div class="method-header">
430 <span class="method-title">Hello</span> (line <span class="line-number">450</span>)
433 <!-- ========== Info from phpDoc block ========= -->
434 <p class="short-description">Sends the HELO command to the smtp server.</p>
435 <p class="description"><p>This makes sure that we and the server are in the same known state.</p><p>Implements from rfc 821: HELO <SP> <domain> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500, 501, 504, 421</p></p>
437 <li><span class="field">access:</span> public</li>
440 <div class="method-signature">
441 <span class="method-result">bool</span>
442 <span class="method-name">
445 ([<span class="var-type">mixed</span> <span class="var-name">$host</span> = <span class="var-default">""</span>])
451 <a name="methodHelp" id="Help"><!-- --></a>
454 <div class="method-header">
455 <span class="method-title">Help</span> (line <span class="line-number">524</span>)
458 <!-- ========== Info from phpDoc block ========= -->
459 <p class="short-description">Gets help information on the keyword specified. If the keyword</p>
460 <p class="description"><p>is not specified then returns generic help, ussually contianing A list of keywords that help is available on. This function returns the results back to the user. It is up to the user to handle the returned data. If an error occurs then false is returned with $this->error set appropiately.</p><p>Implements rfc 821: HELP [ <SP> <string> ] <CRLF></p><p>SMTP CODE SUCCESS: 211,214 SMTP CODE ERROR : 500,501,502,504,421</p></p>
462 <li><span class="field">access:</span> public</li>
465 <div class="method-signature">
466 <span class="method-result">string</span>
467 <span class="method-name">
470 ([<span class="var-type">mixed</span> <span class="var-name">$keyword</span> = <span class="var-default">""</span>])
476 <a name="methodMail" id="Mail"><!-- --></a>
477 <div class="evenrow">
479 <div class="method-header">
480 <span class="method-title">Mail</span> (line <span class="line-number">576</span>)
483 <!-- ========== Info from phpDoc block ========= -->
484 <p class="short-description">Starts a mail transaction from the email address specified in $from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command.</p>
485 <p class="description"><p>Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,421</p></p>
487 <li><span class="field">access:</span> public</li>
490 <div class="method-signature">
491 <span class="method-result">bool</span>
492 <span class="method-name">
495 (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
501 <a name="methodNoop" id="Noop"><!-- --></a>
504 <div class="method-header">
505 <span class="method-title">Noop</span> (line <span class="line-number">618</span>)
508 <!-- ========== Info from phpDoc block ========= -->
509 <p class="short-description">Sends the command NOOP to the SMTP server.</p>
510 <p class="description"><p>Implements from rfc 821: NOOP <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500, 421</p></p>
512 <li><span class="field">access:</span> public</li>
515 <div class="method-signature">
516 <span class="method-result">bool</span>
517 <span class="method-name">
526 <a name="methodQuit" id="Quit"><!-- --></a>
527 <div class="evenrow">
529 <div class="method-header">
530 <span class="method-title">Quit</span> (line <span class="line-number">661</span>)
533 <!-- ========== Info from phpDoc block ========= -->
534 <p class="short-description">Sends the quit command to the server and then closes the socket if there is no error or the $close_on_error argument is true.</p>
535 <p class="description"><p>Implements from rfc 821: QUIT <CRLF></p><p>SMTP CODE SUCCESS: 221 SMTP CODE ERROR : 500</p></p>
537 <li><span class="field">access:</span> public</li>
540 <div class="method-signature">
541 <span class="method-result">bool</span>
542 <span class="method-name">
545 ([<span class="var-type">mixed</span> <span class="var-name">$close_on_error</span> = <span class="var-default">true</span>])
551 <a name="methodRecipient" id="Recipient"><!-- --></a>
554 <div class="method-header">
555 <span class="method-title">Recipient</span> (line <span class="line-number">715</span>)
558 <!-- ========== Info from phpDoc block ========= -->
559 <p class="short-description">Sends the command RCPT to the SMTP server with the TO: argument of $to.</p>
560 <p class="description"><p>Returns true if the recipient was accepted false if it was rejected.</p><p>Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF></p><p>SMTP CODE SUCCESS: 250,251 SMTP CODE FAILURE: 550,551,552,553,450,451,452 SMTP CODE ERROR : 500,501,503,421</p></p>
562 <li><span class="field">access:</span> public</li>
565 <div class="method-signature">
566 <span class="method-result">bool</span>
567 <span class="method-name">
570 (<span class="var-type">mixed</span> <span class="var-name">$to</span>)
576 <a name="methodReset" id="Reset"><!-- --></a>
577 <div class="evenrow">
579 <div class="method-header">
580 <span class="method-title">Reset</span> (line <span class="line-number">759</span>)
583 <!-- ========== Info from phpDoc block ========= -->
584 <p class="short-description">Sends the RSET command to abort and transaction that is currently in progress. Returns true if successful false otherwise.</p>
585 <p class="description"><p>Implements rfc 821: RSET <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500,501,504,421</p></p>
587 <li><span class="field">access:</span> public</li>
590 <div class="method-signature">
591 <span class="method-result">bool</span>
592 <span class="method-name">
601 <a name="methodSend" id="Send"><!-- --></a>
604 <div class="method-header">
605 <span class="method-title">Send</span> (line <span class="line-number">808</span>)
608 <!-- ========== Info from phpDoc block ========= -->
609 <p class="short-description">Starts a mail transaction from the email address specified in</p>
610 <p class="description"><p>$from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command. This command will send the message to the users terminal if they are logged in.</p><p>Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,502,421</p></p>
612 <li><span class="field">access:</span> public</li>
615 <div class="method-signature">
616 <span class="method-result">bool</span>
617 <span class="method-name">
620 (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
626 <a name="methodSendAndMail" id="SendAndMail"><!-- --></a>
627 <div class="evenrow">
629 <div class="method-header">
630 <span class="method-title">SendAndMail</span> (line <span class="line-number">856</span>)
633 <!-- ========== Info from phpDoc block ========= -->
634 <p class="short-description">Starts a mail transaction from the email address specified in</p>
635 <p class="description"><p>$from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command. This command will send the message to the users terminal if they are logged in and send them an email.</p><p>Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,502,421</p></p>
637 <li><span class="field">access:</span> public</li>
640 <div class="method-signature">
641 <span class="method-result">bool</span>
642 <span class="method-name">
645 (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
651 <a name="methodSendOrMail" id="SendOrMail"><!-- --></a>
654 <div class="method-header">
655 <span class="method-title">SendOrMail</span> (line <span class="line-number">904</span>)
658 <!-- ========== Info from phpDoc block ========= -->
659 <p class="short-description">Starts a mail transaction from the email address specified in</p>
660 <p class="description"><p>$from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command. This command will send the message to the users terminal if they are logged in or mail it to them if they are not.</p><p>Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,502,421</p></p>
662 <li><span class="field">access:</span> public</li>
665 <div class="method-signature">
666 <span class="method-result">bool</span>
667 <span class="method-name">
670 (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
676 <a name="methodTurn" id="Turn"><!-- --></a>
677 <div class="evenrow">
679 <div class="method-header">
680 <span class="method-title">Turn</span> (line <span class="line-number">949</span>)
683 <!-- ========== Info from phpDoc block ========= -->
684 <p class="short-description">This is an optional command for SMTP that this class does not support. This method is here to make the RFC821 Definition complete for this class and __may__ be implimented in the future</p>
685 <p class="description"><p>Implements from rfc 821: TURN <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE FAILURE: 502 SMTP CODE ERROR : 500, 503</p></p>
687 <li><span class="field">access:</span> public</li>
690 <div class="method-signature">
691 <span class="method-result">bool</span>
692 <span class="method-name">
701 <a name="methodVerify" id="Verify"><!-- --></a>
704 <div class="method-header">
705 <span class="method-title">Verify</span> (line <span class="line-number">971</span>)
708 <!-- ========== Info from phpDoc block ========= -->
709 <p class="short-description">Verifies that the name is recognized by the server.</p>
710 <p class="description"><p>Returns false if the name could not be verified otherwise the response from the server is returned.</p><p>Implements rfc 821: VRFY <SP> <string> <CRLF></p><p>SMTP CODE SUCCESS: 250,251 SMTP CODE FAILURE: 550,551,553 SMTP CODE ERROR : 500,501,502,421</p></p>
712 <li><span class="field">access:</span> public</li>
715 <div class="method-signature">
716 <span class="method-result">int</span>
717 <span class="method-name">
720 (<span class="var-type">mixed</span> <span class="var-name">$name</span>)
730 <p class="notes" id="credit">
731 Documention generated on Mon, 28 Jul 2003 23:25:50 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0</a>