VERSION
VERSION = '5.2.7'
The PHPMailer SMTP Version number.
PHPMailer RFC821 SMTP email transport class.
Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
PHP Version 5.0.0
type |
int |
---|
type |
string |
---|
$do_debug :
Debug output level.
Options: 0: no output 1: commands 2: data and commands 3: as 2 plus connection status 4: low level data output
type |
int |
---|
$Debugoutput :
The function/method to use for debugging output.
Options: 'echo', 'html' or 'error_log'
type |
string |
---|
$Timeout :
The timeout value for connection, in seconds.
Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
type |
int |
---|
None found |
connect(string $host, integer $port = null, integer $timeout = 30, array $options = array()) : boolean
Connect to an SMTP server.
string | $host | SMTP server IP or host name |
integer | $port | The port number to connect to |
integer | $timeout | How long to wait for the connection to open |
array | $options | An array of options for stream_context_create() |
None found |
None found |
authenticate(string $username, string $password, string $authtype = 'LOGIN', string $realm = '', string $workstation = '') : boolean
Perform SMTP authentication.
Must be run after hello().
string | $username | The user name |
string | $password | The password |
string | $authtype | The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5) |
string | $realm | The auth realm for NTLM |
string | $workstation | The auth workstation for NTLM |
True if successfully authenticated.
None found |
None found |
close() : void
Close the socket and clean up the state of the class.
Don't use this function without first trying to use QUIT.
None found |
data(string $msg_data) : boolean
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
string | $msg_data | Message data to send |
None found |
hello(string $host = '') : boolean
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
string | $host | The host name or IP to connect to |
None found |
mail(string $from) : boolean
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
string | $from | Source address of this message |
None found |
quit(boolean $close_on_error = true) : boolean
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
boolean | $close_on_error | Should the connection close if an error occurs? |
None found |
recipient(string $to) : boolean
Send an SMTP RCPT command.
Sets the TO argument to $to.
Returns true if the recipient was accepted false if it was rejected.
Implements from rfc 821: RCPT
string | $to | The address the message is being sent to |
None found |
reset() : boolean
Send an SMTP RSET command.
Abort any transaction that is currently in progress.
Implements rfc 821: RSET
True on success.
None found |
sendAndMail(string $from) : boolean
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
string | $from | The address the message is from |
None found |
verify(string $name) : boolean
Send an SMTP VRFY command.
string | $name | The name to verify |
None found |
noop() : boolean
Send an SMTP NOOP command.
Used to keep keep-alives alive, doesn't actually do anything
None found |
turn() : boolean
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
None found |
client_send(string $data) : integer|boolean
Send raw data to the server.
string | $data | The data to send |
The number of bytes sent to the server or false on error
None found |
None found |
None found |
setVerp(boolean $enabled = false)
Enable or disable VERP address generation.
boolean | $enabled |
None found |
None found |
setDebugOutput(string $method = 'echo')
Set debug output method.
string | $method | The function/method to use for debugging output. |
None found |
None found |
None found |
None found |
None found |
None found |
edebug(string $str) : void
Output debugging info via a user-selected method.
string | $str | Debug string to output |
None found |
hmac(string $data, string $key) : string
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 |
None found |
sendHello(string $hello, string $host) : boolean
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 |
None found |
sendCommand(string $command, string $commandstring, integer|array $expect) : boolean
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 |
integer|array | $expect | One or more expected integer success codes |
True on success.
None found |
get_lines() : string
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.
None found |