[ Index ]

PHP Cross Reference of WordPress




/wp-includes/ -> class-smtp.php (summary)

PHPMailer RFC821 SMTP email transport class. PHP Version 5

Author: Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
Author: Jim Jagielski (jimjag) <jimjag@gmail.com>
Author: Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
Author: Brent R. Matzelle (original founder)
Copyright: 2014 Marcus Bointon
Copyright: 2010 - 2012 Jim Jagielski
Copyright: 2004 - 2009 Andy Prevost
License: http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
File Size: 1186 lines (39 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SMTP:: (37 methods):

Class: SMTP  - X-Ref

PHPMailer RFC821 SMTP email transport class.
Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.

edebug($str, $level = 0)   X-Ref
Output debugging info via a user-selected method.

param: string $str Debug string to output
param: integer $level The debug level of this message; see DEBUG_* constants
return: void

connect($host, $port = null, $timeout = 30, $options = array()   X-Ref
Connect to an SMTP server.

param: string $host SMTP server IP or host name
param: integer $port The port number to connect to
param: integer $timeout How long to wait for the connection to open
param: array $options An array of options for stream_context_create()
return: boolean

startTLS()   X-Ref
Initiate a TLS (encrypted) session.

return: boolean

authenticate($username,$password,$authtype = null,$realm = '',$workstation = '',$OAuth = null)   X-Ref
Perform SMTP authentication.
Must be run after hello().

param: string $username The user name
param: string $password The password
param: string $authtype The auth type (PLAIN, LOGIN, CRAM-MD5)
param: string $realm The auth realm for NTLM
param: string $workstation The auth workstation for NTLM
param: null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
return: bool True if successfully authenticated.* @access public

hmac($data, $key)   X-Ref
Calculate an MD5 HMAC hash.
Works like hash_hmac('md5', $data, $key)
in case that function is not available

param: string $data The data to hash
param: string $key  The key to hash with
return: string

connected()   X-Ref
Check connection state.

return: boolean True if connected.

close()   X-Ref
Close the socket and clean up the state of the class.
Don't use this function without first trying to use QUIT.

return: void

data($msg_data)   X-Ref
Send an SMTP DATA command.
Issues a data command and sends the msg_data to the server,
finalizing 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>

param: string $msg_data Message data to send
return: boolean

hello($host = '')   X-Ref
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.

param: string $host The host name or IP to connect to
return: boolean

sendHello($hello, $host)   X-Ref
Send an SMTP HELO or EHLO command.
Low-level implementation used by hello()

param: string $hello The HELO string
param: string $host The hostname to say we are
return: boolean

parseHelloFields($type)   X-Ref
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.

param: string $type - 'HELO' or 'EHLO'

mail($from)   X-Ref
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>

param: string $from Source address of this message
return: boolean

quit($close_on_error = true)   X-Ref
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>

param: boolean $close_on_error Should the connection close if an error occurs?
return: boolean

recipient($address)   X-Ref
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>

param: string $address The address the message is being sent to
return: boolean

reset()   X-Ref
Send an SMTP RSET command.
Abort any transaction that is currently in progress.
Implements rfc 821: RSET <CRLF>

return: boolean True on success.

sendCommand($command, $commandstring, $expect)   X-Ref
Send a command to an SMTP server and check its return code.

param: string $command The command name - not sent to the server
param: string $commandstring The actual command to send
param: integer|array $expect One or more expected integer success codes
return: boolean True on success.

sendAndMail($from)   X-Ref
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>

param: string $from The address the message is from
return: boolean

verify($name)   X-Ref
Send an SMTP VRFY command.

param: string $name The name to verify
return: boolean

noop()   X-Ref
Send an SMTP NOOP command.
Used to keep keep-alives alive, doesn't actually do anything

return: boolean

turn()   X-Ref
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>

return: boolean

client_send($data)   X-Ref
Send raw data to the server.

param: string $data The data to send
return: integer|boolean The number of bytes sent to the server or false on error

getError()   X-Ref
Get the latest error.

return: array

getServerExtList()   X-Ref
Get SMTP extensions available on the server

return: array|null

getServerExt($name)   X-Ref
A multipurpose method
The method works in three ways, dependent on argument value and current state
1. HELO/EHLO was not sent - returns null and set up $this->error
2. HELO was sent
$name = 'HELO': returns server name
$name = 'EHLO': returns boolean false
$name = any string: returns null and set up $this->error
3. EHLO was sent
$name = 'HELO'|'EHLO': returns server name
$name = any string: if extension $name exists, returns boolean True
or its options. Otherwise returns boolean False
In other words, one can use this method to detect 3 conditions:
- null returned: handshake was not or we don't know about ext (refer to $this->error)
- false returned: the requested feature exactly not exists
- positive value returned: the requested feature exists

param: string $name Name of SMTP extension or 'HELO'|'EHLO'
return: mixed

getLastReply()   X-Ref
Get the last reply from the server.

return: string

get_lines()   X-Ref
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.

return: string

setVerp($enabled = false)   X-Ref
Enable or disable VERP address generation.

param: boolean $enabled

getVerp()   X-Ref
Get VERP address generation mode.

return: boolean

setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '')   X-Ref
Set error messages and codes.

param: string $message The error message
param: string $detail Further detail on the error
param: string $smtp_code An associated SMTP error code
param: string $smtp_code_ex Extended SMTP code

setDebugOutput($method = 'echo')   X-Ref
Set debug output method.

param: string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.

getDebugOutput()   X-Ref
Get debug output method.

return: string

setDebugLevel($level = 0)   X-Ref
Set debug output level.

param: integer $level

getDebugLevel()   X-Ref
Get debug output level.

return: integer

setTimeout($timeout = 0)   X-Ref
Set SMTP timeout.

param: integer $timeout

getTimeout()   X-Ref
Get SMTP timeout.

return: integer

errorHandler($errno, $errmsg)   X-Ref
Reports an error number and string.

param: integer $errno The error number returned by PHP.
param: string $errmsg The error message returned by PHP.

getLastTransactionID()   X-Ref
Will return the ID of the last smtp transaction based on a list of patterns provided
in SMTP::$smtp_transaction_id_patterns.
If no reply has been received yet, it will return null.
If no pattern has been matched, it will return false.

return: bool|null|string

Generated: Sat Jul 20 01:00:03 2019 Cross-referenced by PHPXref 0.7.1