SMTP
- Source
wp-includes/PHPMailer/SMTP.php:31
PHPMailer RFC821 SMTP email transport class.
Description
Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
Compatibility
- WordPress
- core
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 14
$do_debugintpublic- Debug output level.
$Debugoutputstring|callable|Psr\Log\LoggerInterfacepublic- How to handle debug output.
$do_verpboolpublic- Whether to use VERP.
$do_smtputf8boolpublic- Whether to use SMTPUTF8.
$Timeoutintpublic- The timeout value for connection, in seconds.
$Timelimitintpublic- How long to wait for commands to complete, in seconds.
$smtp_transaction_id_patternsstring[]protected- Patterns to extract an SMTP transaction id from reply to a DATA command.
$xclient_allowed_attributesarraypublic static- Allowed SMTP XCLIENT attributes.
$last_smtp_transaction_idstring|bool|nullprotected- The last transaction ID issued in response to a DATA command, if one was detected.
$smtp_connPHPMailer\PHPMailer\?resourceprotected- The socket for the server connection.
$errorarrayprotected- Error information, if any, for the last SMTP command.
$helo_rplystring|nullprotected- The reply the server sent to us for HELO.
$server_capsarray|nullprotected- The set of SMTP extensions sent in reply to EHLO command.
$last_replystringprotected- The most recent reply received from the server.
Methods · 43
- edebug()Output debugging info via a user-selected method.
- connect()Connect to an SMTP server.
- getSMTPConnection()Create connection to the SMTP server.
- startTLS()Initiate a TLS (encrypted) session.
- authenticate()Perform SMTP authentication.
- hmac()Calculate an MD5 HMAC hash.
- connected()Check connection state.
- close()Close the socket and clean up the state of the class.
- iterateLines()
- data()Send an SMTP DATA command.
- hello()Send an SMTP HELO or EHLO command.
- sendHello()Send an SMTP HELO or EHLO command.
- parseHelloFields()Parse a reply to HELO/EHLO command to discover server extensions.
- mail()Send an SMTP MAIL command.
- quit()Send an SMTP QUIT command.
- recipient()Send an SMTP RCPT command.
- xclient()Send SMTP XCLIENT command to server and check its return code.
- reset()Send an SMTP RSET command.
- sendCommand()Send a command to an SMTP server and check its return code.
- sendAndMail()Send an SMTP SAML command.
- verify()Send an SMTP VRFY command.
- noop()Send an SMTP NOOP command.
- turn()Send an SMTP TURN command.
- client_send()Send raw data to the server.
- getError()Get the latest error.
- getServerExtList()Get SMTP extensions available on the server.
- getServerExt()Get metadata about the SMTP server from its HELO/EHLO response.
- getLastReply()Get the last reply from the server.
- get_lines()Read the SMTP server's response.
- setVerp()Enable or disable VERP address generation.
- getVerp()Get VERP address generation mode.
- setSMTPUTF8()Enable or disable use of SMTPUTF8.
- getSMTPUTF8()Get SMTPUTF8 use.
- setError()Set error messages and codes.
- setDebugOutput()Set debug output method.
- getDebugOutput()Get debug output method.
- setDebugLevel()Set debug output level.
- getDebugLevel()Get debug output level.
- setTimeout()Set SMTP timeout.
- getTimeout()Get SMTP timeout.
- errorHandler()Reports an error number and string.
- recordLastTransactionID()Extract and return the ID of the last SMTP transaction based on a list of patterns provided in SMTP::$smtp_transaction_id_patterns.
- getLastTransactionID()Get the queue/transaction ID of the last SMTP transaction If no reply has been received yet, it will return null.
Source code
class SMTP{ /** * The PHPMailer SMTP version number. * * @var string * @deprecated This constant will be removed in PHPMailer 8.0. Use `PHPMailer::VERSION` instead. */ const VERSION = '7.1.1'; /** * SMTP line break constant. * * @var string */ const LE = "\r\n"; /** * The SMTP port to use if one is not specified. * * @var int */ const DEFAULT_PORT = 25; /** * The SMTPs port to use if one is not specified. * * @var int */ const DEFAULT_SECURE_PORT = 465; /** * The maximum line length allowed by RFC 5321 section 4.5.3.1.6, * *excluding* a trailing CRLF break. * * @see https://www.rfc-editor.org/rfc/rfc5321#section-4.5.3.1.6 * * @var int */ const MAX_LINE_LENGTH = 998; /** * The maximum line length allowed for replies in RFC 5321 section 4.5.3.1.5, * *including* a trailing CRLF line break. * * @see https://www.rfc-editor.org/rfc/rfc5321#section-4.5.3.1.5 * * @var int */ const MAX_REPLY_LENGTH = 512; /** * Debug level for no output. * * @var int */ const DEBUG_OFF = 0; /** * Debug level to show client -> server messages. * * @var int */ const DEBUG_CLIENT = 1; /** * Debug level to show client -> server and server -> client messages. * * @var int */ const DEBUG_SERVER = 2; /** * Debug level to show connection status, client -> server and server -> client messages. * * @var int */ const DEBUG_CONNECTION = 3; /**Changelog
3 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
7.0.4
Method
iterateLines() added.verified against source6.9.7
Method
setSMTPUTF8() added.verified against source6.9.7
Method
getSMTPUTF8() added.verified against sourceAbout this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/PHPMailer/SMTP.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.