Class SMTP
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. original author: Chris Ryan
Copyright: 2004 - 2008 Andy Prevost
License: Distributed under the Lesser General Public License (LGPL)
Author: Andy Prevost
Author: Marcus Bointon
Used by:
PHPMailer::SmtpSend()
Used by:
PHPMailer::SmtpConnect()
Located at vendors/phpmailer/class.smtp.php
Methods summary
public
|
|
public
boolean
|
#
Connect( mixed $host, mixed $port = 0, mixed $tval = 30 )
Connect to the server specified on the port specified. 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. |
public
boolean
|
|
public
boolean
|
#
Authenticate( mixed $username, mixed $password )
Performs SMTP authentication. Must be run after running the Hello() method. Returns true if successfully authenticated. |
public
boolean
|
|
public
|
#
Close( )
Closes the socket and cleans up the state of the class. It is not considered good to use this function without first trying to use QUIT. |
public
boolean
|
#
Data( mixed $msg_data )
Issues a data command and sends the msg_data to the server 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>. |
public
boolean
|
#
Hello( mixed $host = '' )
Sends the HELO command to the smtp server. This makes sure that we and the server are in the same known state. |
private
boolean
|
|
public
boolean
|
#
Mail( mixed $from )
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. |
public
boolean
|
#
Quit( mixed $close_on_error = true )
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. |
public
boolean
|
#
Recipient( mixed $to )
Sends the command RCPT to the SMTP server with the TO: argument of $to. Returns true if the recipient was accepted false if it was rejected. |
public
boolean
|
#
Reset( )
Sends the RSET command to abort and transaction that is currently in progress. Returns true if successful false otherwise. |
public
boolean
|
#
SendAndMail( mixed $from )
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. This command will send the message to the users terminal if they are logged in and send them an email. |
public
boolean
|
#
Turn( )
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 |
public
array
|
|
private
string
|
#
get_lines( )
Read in as many lines as possible either before eof or socket timeout occurs on the operation. With SMTP we can tell if we have more lines to read if the 4th character is '-' symbol. If it is a space then we don't need to read anything else. |
Magic methods summary
Properties summary
public
integer
|
$SMTP_PORT |
#
SMTP server port |
public
string
|
$CRLF |
#
SMTP reply line ending |
public
boolean
|
$do_debug |
#
Sets whether debugging is turned on |
public
boolean
|
$do_verp |
#
Sets VERP use on/off (default is off) |
private
mixed
|
$smtp_conn | |
private
mixed
|
$error | |
private
mixed
|
$helo_rply |