ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
PHPMailer RFC821 SMTP email transport class. More...
Public Member Functions | |
connect ($host, $port=null, $timeout=30, $options=[]) | |
Connect to an SMTP server. More... | |
startTLS () | |
Initiate a TLS (encrypted) session. More... | |
authenticate ( $username, $password, $authtype=null, $OAuth=null) | |
Perform SMTP authentication. More... | |
connected () | |
Check connection state. More... | |
close () | |
Close the socket and clean up the state of the class. More... | |
data ($msg_data) | |
Send an SMTP DATA command. More... | |
hello ($host='') | |
Send an SMTP HELO or EHLO command. More... | |
mail ($from) | |
Send an SMTP MAIL command. More... | |
quit ($close_on_error=true) | |
Send an SMTP QUIT command. More... | |
recipient ($address, $dsn='') | |
Send an SMTP RCPT command. More... | |
reset () | |
Send an SMTP RSET command. More... | |
sendAndMail ($from) | |
Send an SMTP SAML command. More... | |
verify ($name) | |
Send an SMTP VRFY command. More... | |
noop () | |
Send an SMTP NOOP command. More... | |
turn () | |
Send an SMTP TURN command. More... | |
client_send ($data, $command='') | |
Send raw data to the server. More... | |
getError () | |
Get the latest error. More... | |
getServerExtList () | |
Get SMTP extensions available on the server. More... | |
getServerExt ($name) | |
Get metadata about the SMTP server from its HELO/EHLO response. More... | |
getLastReply () | |
Get the last reply from the server. More... | |
setVerp ($enabled=false) | |
Enable or disable VERP address generation. More... | |
getVerp () | |
Get VERP address generation mode. More... | |
setDebugOutput ($method='echo') | |
Set debug output method. More... | |
getDebugOutput () | |
Get debug output method. More... | |
setDebugLevel ($level=0) | |
Set debug output level. More... | |
getDebugLevel () | |
Get debug output level. More... | |
setTimeout ($timeout=0) | |
Set SMTP timeout. More... | |
getTimeout () | |
Get SMTP timeout. More... | |
getLastTransactionID () | |
Get the queue/transaction ID of the last SMTP transaction If no reply has been received yet, it will return null. More... | |
Data Fields | |
const | VERSION = '6.1.6' |
const | LE = "\r\n" |
const | DEFAULT_PORT = 25 |
const | MAX_LINE_LENGTH = 998 |
const | MAX_REPLY_LENGTH = 512 |
const | DEBUG_OFF = 0 |
const | DEBUG_CLIENT = 1 |
const | DEBUG_SERVER = 2 |
const | DEBUG_CONNECTION = 3 |
const | DEBUG_LOWLEVEL = 4 |
$do_debug = self::DEBUG_OFF | |
$Debugoutput = 'echo' | |
$do_verp = false | |
$Timeout = 300 | |
$Timelimit = 300 | |
Protected Member Functions | |
edebug ($str, $level=0) | |
Output debugging info via a user-selected method. More... | |
hmac ($data, $key) | |
Calculate an MD5 HMAC hash. More... | |
sendHello ($hello, $host) | |
Send an SMTP HELO or EHLO command. More... | |
parseHelloFields ($type) | |
Parse a reply to HELO/EHLO command to discover server extensions. More... | |
sendCommand ($command, $commandstring, $expect) | |
Send a command to an SMTP server and check its return code. More... | |
get_lines () | |
Read the SMTP server's response. More... | |
setError ($message, $detail='', $smtp_code='', $smtp_code_ex='') | |
Set error messages and codes. More... | |
errorHandler ($errno, $errmsg, $errfile='', $errline=0) | |
Reports an error number and string. More... | |
recordLastTransactionID () | |
Extract and return the ID of the last SMTP transaction based on a list of patterns provided in SMTP::$smtp_transaction_id_patterns. More... | |
Protected Attributes | |
$smtp_transaction_id_patterns | |
$last_smtp_transaction_id | |
$smtp_conn | |
$error | |
$helo_rply | |
$server_caps | |
$last_reply = '' | |
PHPMailer RFC821 SMTP email transport class.
Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
PHPMailer\PHPMailer\SMTP::authenticate | ( | $username, | |
$password, | |||
$authtype = null , |
|||
$OAuth = null |
|||
) |
Perform SMTP authentication.
Must be run after hello().
string | $username | The user name |
string | $password | The password |
string | $authtype | The auth type (CRAM-MD5, PLAIN, LOGIN, XOAUTH2) |
OAuth | $OAuth | An optional OAuth instance for XOAUTH2 authentication |
Definition at line 448 of file SMTP.php.
References $password, $response, PHPMailer\PHPMailer\SMTP\edebug(), PHPMailer\PHPMailer\SMTP\hmac(), PHPMailer\PHPMailer\SMTP\sendCommand(), and PHPMailer\PHPMailer\SMTP\setError().
PHPMailer\PHPMailer\SMTP::client_send | ( | $data, | |
$command = '' |
|||
) |
Send raw data to the server.
string | $data | The data to send |
string | $command | Optionally, the command this is part of, used only for controlling debug output |
Definition at line 1057 of file SMTP.php.
References $data, $result, and PHPMailer\PHPMailer\SMTP\edebug().
Referenced by PHPMailer\PHPMailer\SMTP\data(), and PHPMailer\PHPMailer\SMTP\sendCommand().
PHPMailer\PHPMailer\SMTP::close | ( | ) |
Close the socket and clean up the state of the class.
Don't use this function without first trying to use QUIT.
Definition at line 638 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\edebug(), and PHPMailer\PHPMailer\SMTP\setError().
Referenced by PHPMailer\PHPMailer\SMTP\connected(), and PHPMailer\PHPMailer\SMTP\quit().
PHPMailer\PHPMailer\SMTP::connect | ( | $host, | |
$port = null , |
|||
$timeout = 30 , |
|||
$options = [] |
|||
) |
Connect to an SMTP server.
string | $host | SMTP server IP or host name |
int | $port | The port number to connect to |
int | $timeout | How long to wait for the connection to open |
array | $options | An array of options for stream_context_create() |
Definition at line 312 of file SMTP.php.
References PHPMailer\PHPMailer\$options, PHPMailer\PHPMailer\SMTP\connected(), PHPMailer\PHPMailer\SMTP\edebug(), PHPMailer\PHPMailer\SMTP\get_lines(), and PHPMailer\PHPMailer\SMTP\setError().
PHPMailer\PHPMailer\SMTP::connected | ( | ) |
Check connection state.
Definition at line 611 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\close(), and PHPMailer\PHPMailer\SMTP\edebug().
Referenced by PHPMailer\PHPMailer\SMTP\connect(), and PHPMailer\PHPMailer\SMTP\sendCommand().
PHPMailer\PHPMailer\SMTP::data | ( | $msg_data | ) |
Send an SMTP DATA command.
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 separated by an additional <CRLF>. Implements RFC 821: DATA <CRLF>.
string | $msg_data | Message data to send |
Definition at line 664 of file SMTP.php.
References $result, PHPMailer\PHPMailer\SMTP\$Timelimit, PHPMailer\PHPMailer\SMTP\client_send(), PHPMailer\PHPMailer\SMTP\recordLastTransactionID(), and PHPMailer\PHPMailer\SMTP\sendCommand().
|
protected |
Output debugging info via a user-selected method.
string | $str | Debug string to output |
int | $level | The debug level of this message; see DEBUG_* constants |
Definition at line 253 of file SMTP.php.
References Monolog\Handler\error_log().
Referenced by PHPMailer\PHPMailer\SMTP\authenticate(), PHPMailer\PHPMailer\SMTP\client_send(), PHPMailer\PHPMailer\SMTP\close(), PHPMailer\PHPMailer\SMTP\connect(), PHPMailer\PHPMailer\SMTP\connected(), PHPMailer\PHPMailer\SMTP\errorHandler(), PHPMailer\PHPMailer\SMTP\get_lines(), PHPMailer\PHPMailer\SMTP\sendCommand(), and PHPMailer\PHPMailer\SMTP\turn().
|
protected |
Reports an error number and string.
int | $errno | The error number returned by PHP |
string | $errmsg | The error message returned by PHP |
string | $errfile | The file the error occurred in |
int | $errline | The line number the error occurred on |
Definition at line 1315 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\edebug(), and PHPMailer\PHPMailer\SMTP\setError().
|
protected |
Read the SMTP server's response.
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.
Definition at line 1153 of file SMTP.php.
References $data, $info, PHPMailer\PHPMailer\SMTP\$smtp_conn, PHPMailer\PHPMailer\SMTP\$Timelimit, and PHPMailer\PHPMailer\SMTP\edebug().
Referenced by PHPMailer\PHPMailer\SMTP\connect(), and PHPMailer\PHPMailer\SMTP\sendCommand().
PHPMailer\PHPMailer\SMTP::getDebugLevel | ( | ) |
Get debug output level.
Definition at line 1282 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$do_debug.
PHPMailer\PHPMailer\SMTP::getDebugOutput | ( | ) |
Get debug output method.
Definition at line 1262 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$Debugoutput.
PHPMailer\PHPMailer\SMTP::getError | ( | ) |
Get the latest error.
Definition at line 1079 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$error.
PHPMailer\PHPMailer\SMTP::getLastReply | ( | ) |
Get the last reply from the server.
Definition at line 1139 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$last_reply.
Referenced by PHPMailer\PHPMailer\SMTP\recordLastTransactionID().
PHPMailer\PHPMailer\SMTP::getLastTransactionID | ( | ) |
Get the queue/transaction ID of the last SMTP transaction If no reply has been received yet, it will return null.
If no pattern was matched, it will return false.
Definition at line 1367 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$last_smtp_transaction_id.
PHPMailer\PHPMailer\SMTP::getServerExt | ( | $name | ) |
Get metadata about the SMTP server from its HELO/EHLO response.
The method works in three ways, dependent on argument value and current state:
string | $name | Name of SMTP extension or 'HELO'|'EHLO' |
Definition at line 1111 of file SMTP.php.
References $name, and PHPMailer\PHPMailer\SMTP\setError().
PHPMailer\PHPMailer\SMTP::getServerExtList | ( | ) |
Get SMTP extensions available on the server.
Definition at line 1089 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$server_caps.
PHPMailer\PHPMailer\SMTP::getTimeout | ( | ) |
Get SMTP timeout.
Definition at line 1302 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$Timeout.
PHPMailer\PHPMailer\SMTP::getVerp | ( | ) |
Get VERP address generation mode.
Definition at line 1224 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$do_verp.
PHPMailer\PHPMailer\SMTP::hello | ( | $host = '' | ) |
Send an SMTP HELO or EHLO command.
Used to identify the sending server to the receiving server. This makes sure that client and server are in a known state. Implements RFC 821: HELO <SP> <domain> <CRLF> and RFC 2821 EHLO.
string | $host | The host name or IP to connect to |
Definition at line 756 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\sendHello().
|
protected |
Calculate an MD5 HMAC hash.
Works like hash_hmac('md5', $data, $key) in case that function is not available.
string | $data | The data to hash |
string | $key | The key to hash with |
Definition at line 579 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\authenticate().
PHPMailer\PHPMailer\SMTP::mail | ( | $from | ) |
Send an SMTP MAIL command.
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. Implements RFC 821: MAIL <SP> FROM:<reverse-path> <CRLF>.
string | $from | Source address of this message |
Definition at line 840 of file SMTP.php.
References $from, and PHPMailer\PHPMailer\SMTP\sendCommand().
PHPMailer\PHPMailer\SMTP::noop | ( | ) |
Send an SMTP NOOP command.
Used to keep keep-alives alive, doesn't actually do anything.
Definition at line 1027 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\sendCommand().
|
protected |
Parse a reply to HELO/EHLO command to discover server extensions.
In case of HELO, the only parameter that can be discovered is a server name.
string | $type | HELO or EHLO |
Definition at line 792 of file SMTP.php.
References $n, $name, $s, and $type.
Referenced by PHPMailer\PHPMailer\SMTP\sendHello().
PHPMailer\PHPMailer\SMTP::quit | ( | $close_on_error = true | ) |
Send an SMTP QUIT command.
Closes the socket if there is no error or the $close_on_error argument is true. Implements from RFC 821: QUIT <CRLF>.
bool | $close_on_error | Should the connection close if an error occurs? |
Definition at line 860 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$error, PHPMailer\PHPMailer\SMTP\close(), and PHPMailer\PHPMailer\SMTP\sendCommand().
PHPMailer\PHPMailer\SMTP::recipient | ( | $address, | |
$dsn = '' |
|||
) |
Send an SMTP RCPT command.
Sets the TO argument to $toaddr. Returns true if the recipient was accepted false if it was rejected. Implements from RFC 821: RCPT <SP> TO:<forward-path> <CRLF>.
string | $address | The address the message is being sent to |
string | $dsn | Comma separated list of DSN notifications. NEVER, SUCCESS, FAILURE or DELAY. If you specify NEVER all other notifications are ignored. |
Definition at line 884 of file SMTP.php.
References $dsn, and PHPMailer\PHPMailer\SMTP\sendCommand().
|
protected |
Extract and return the ID of the last SMTP transaction based on a list of patterns provided in SMTP::$smtp_transaction_id_patterns.
Relies on the host providing the ID in response to a DATA command. If no reply has been received yet, it will return null. If no pattern was matched, it will return false.
Definition at line 1338 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$last_smtp_transaction_id, and PHPMailer\PHPMailer\SMTP\getLastReply().
Referenced by PHPMailer\PHPMailer\SMTP\data().
PHPMailer\PHPMailer\SMTP::reset | ( | ) |
Send an SMTP RSET command.
Abort any transaction that is currently in progress. Implements RFC 821: RSET <CRLF>.
Definition at line 919 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\sendCommand().
PHPMailer\PHPMailer\SMTP::sendAndMail | ( | $from | ) |
Send an SMTP SAML command.
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. Implements RFC 821: SAML <SP> FROM:<reverse-path> <CRLF>.
string | $from | The address the message is from |
Definition at line 1004 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\sendCommand().
|
protected |
Send a command to an SMTP server and check its return code.
string | $command | The command name - not sent to the server |
string | $commandstring | The actual command to send |
int | array | $expect | One or more expected integer success codes |
Definition at line 933 of file SMTP.php.
References $code, PHPMailer\PHPMailer\SMTP\client_send(), PHPMailer\PHPMailer\SMTP\connected(), PHPMailer\PHPMailer\SMTP\edebug(), PHPMailer\PHPMailer\SMTP\get_lines(), and PHPMailer\PHPMailer\SMTP\setError().
Referenced by PHPMailer\PHPMailer\SMTP\authenticate(), PHPMailer\PHPMailer\SMTP\data(), PHPMailer\PHPMailer\SMTP\mail(), PHPMailer\PHPMailer\SMTP\noop(), PHPMailer\PHPMailer\SMTP\quit(), PHPMailer\PHPMailer\SMTP\recipient(), PHPMailer\PHPMailer\SMTP\reset(), PHPMailer\PHPMailer\SMTP\sendAndMail(), PHPMailer\PHPMailer\SMTP\sendHello(), PHPMailer\PHPMailer\SMTP\startTLS(), and PHPMailer\PHPMailer\SMTP\verify().
|
protected |
Send an SMTP HELO or EHLO command.
Low-level implementation used by hello().
string | $hello | The HELO string |
string | $host | The hostname to say we are |
Definition at line 773 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\$last_reply, PHPMailer\PHPMailer\SMTP\parseHelloFields(), and PHPMailer\PHPMailer\SMTP\sendCommand().
Referenced by PHPMailer\PHPMailer\SMTP\hello().
PHPMailer\PHPMailer\SMTP::setDebugLevel | ( | $level = 0 | ) |
PHPMailer\PHPMailer\SMTP::setDebugOutput | ( | $method = 'echo' | ) |
|
protected |
Set error messages and codes.
string | $message | The error message |
string | $detail | Further detail on the error |
string | $smtp_code | An associated SMTP error code |
string | $smtp_code_ex | Extended SMTP code |
Definition at line 1237 of file SMTP.php.
References $message.
Referenced by PHPMailer\PHPMailer\SMTP\authenticate(), PHPMailer\PHPMailer\SMTP\close(), PHPMailer\PHPMailer\SMTP\connect(), PHPMailer\PHPMailer\SMTP\errorHandler(), PHPMailer\PHPMailer\SMTP\getServerExt(), PHPMailer\PHPMailer\SMTP\sendCommand(), and PHPMailer\PHPMailer\SMTP\turn().
PHPMailer\PHPMailer\SMTP::setTimeout | ( | $timeout = 0 | ) |
PHPMailer\PHPMailer\SMTP::setVerp | ( | $enabled = false | ) |
PHPMailer\PHPMailer\SMTP::startTLS | ( | ) |
Initiate a TLS (encrypted) session.
Definition at line 407 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\sendCommand().
PHPMailer\PHPMailer\SMTP::turn | ( | ) |
Send an SMTP TURN command.
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 implemented in future. Implements from RFC 821: TURN <CRLF>.
Definition at line 1041 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\edebug(), and PHPMailer\PHPMailer\SMTP\setError().
PHPMailer\PHPMailer\SMTP::verify | ( | $name | ) |
Send an SMTP VRFY command.
string | $name | The name to verify |
Definition at line 1016 of file SMTP.php.
References PHPMailer\PHPMailer\SMTP\sendCommand().
PHPMailer\PHPMailer\SMTP::$Debugoutput = 'echo' |
Definition at line 142 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\getDebugOutput().
PHPMailer\PHPMailer\SMTP::$do_debug = self::DEBUG_OFF |
Definition at line 119 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\getDebugLevel().
PHPMailer\PHPMailer\SMTP::$do_verp = false |
Definition at line 152 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\getVerp().
|
protected |
Definition at line 210 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\getError(), and PHPMailer\PHPMailer\SMTP\quit().
|
protected |
Definition at line 242 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\getLastReply(), and PHPMailer\PHPMailer\SMTP\sendHello().
|
protected |
Definition at line 196 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\getLastTransactionID(), and PHPMailer\PHPMailer\SMTP\recordLastTransactionID().
|
protected |
Definition at line 235 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\getServerExtList().
|
protected |
Definition at line 203 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\get_lines().
|
protected |
PHPMailer\PHPMailer\SMTP::$Timelimit = 300 |
Definition at line 171 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\data(), and PHPMailer\PHPMailer\SMTP\get_lines().
PHPMailer\PHPMailer\SMTP::$Timeout = 300 |
Definition at line 163 of file SMTP.php.
Referenced by PHPMailer\PHPMailer\SMTP\getTimeout().