\SMTP
PHPMailer RFC821 SMTP email transport class.
Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
- Author: Chris Ryan
Synopsis
class SMTP
{
- // constants
- const VERSION = '5.2.14';
- const CRLF = "\r\n";
- const DEFAULT_SMTP_PORT = 25;
- const MAX_LINE_LENGTH = 998;
- const DEBUG_OFF = 0;
- const DEBUG_CLIENT = 1;
- const DEBUG_SERVER = 2;
- const DEBUG_CONNECTION = 3;
- const DEBUG_LOWLEVEL = 4;
- // members
- public string $Version = '5.2.14';
- public integer $SMTP_PORT = 25;
- public string $CRLF = "\r\n";
- public integer $do_debug = self::DEBUG_OFF;
- public string|callable $Debugoutput = 'echo';
- public boolean $do_verp = false;
- public integer $Timeout = 300;
- public integer $Timelimit = 300;
- protected $smtp_conn;
- protected array $error = ;
- protected string|null $helo_rply = NULL;
- protected array|null $server_caps = NULL;
- protected string $last_reply = '';
- // methods
- protected void edebug()
- public boolean connect()
- public boolean startTLS()
- public bool authenticate()
- protected string hmac()
- public boolean connected()
- public void close()
- public boolean data()
- public boolean hello()
- protected boolean sendHello()
- protected void parseHelloFields()
- public boolean mail()
- public boolean quit()
- public boolean recipient()
- public boolean reset()
- protected boolean sendCommand()
- public boolean sendAndMail()
- public boolean verify()
- public boolean noop()
- public boolean turn()
- public integer|boolean client_send()
- public array getError()
- public array|null getServerExtList()
- public mixed getServerExt()
- public string getLastReply()
- protected string get_lines()
- public void setVerp()
- public boolean getVerp()
- protected void setError()
- public void setDebugOutput()
- public string getDebugOutput()
- public void setDebugLevel()
- public integer getDebugLevel()
- public void setTimeout()
- public integer getTimeout()
Violations
PHPMessDetector
Line | Rule | Message |
---|---|---|
362 - 496 | CyclomaticComplexity | The method authenticate() has a Cyclomatic Complexity of 26. The configured cyclomatic complexity threshold is 10. |
362 - 496 | NPathComplexity | The method authenticate() has an NPath complexity of 2668. The configured NPath complexity threshold is 200. |
362 - 496 | ExcessiveMethodLength | The method authenticate() has 135 lines of code. Current threshold is set to 100. Avoid really long methods. |
593 - 675 | CyclomaticComplexity | The method data() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. |
593 - 675 | NPathComplexity | The method data() has an NPath complexity of 366. The configured NPath complexity threshold is 200. |
1053 - 1087 | CyclomaticComplexity | The method get_lines() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. |
1104 - 1107 | BooleanGetMethodName | The 'getVerp()' method which returns a boolean should be named 'is...()' or 'has...()' |
Checkstyle
Line | Column | Severity | Message |
---|---|---|---|
252 | 134 | warning | Line exceeds 120 characters; contains 134 characters |
290 | 141 | warning | Line exceeds 120 characters; contains 141 characters |
296 | 141 | warning | Line exceeds 120 characters; contains 141 characters |
299 | 127 | warning | Line exceeds 120 characters; contains 127 characters |
380 | 132 | warning | Line exceeds 120 characters; contains 132 characters |
460 | 136 | warning | Line exceeds 120 characters; contains 136 characters |
867 | 141 | warning | Line exceeds 120 characters; contains 141 characters |
960 | 12 | error | Method name "SMTP::client_send" is not in camel caps format |
1053 | 15 | error | Method name "SMTP::get_lines" is not in camel caps format |
1082 | 125 | warning | Line exceeds 120 characters; contains 125 characters |
Constants
Name | Value |
---|---|
VERSION | '5.2.14' |
CRLF | "\r\n" |
DEFAULT_SMTP_PORT | 25 |
MAX_LINE_LENGTH | 998 |
DEBUG_OFF | 0 |
DEBUG_CLIENT | 1 |
DEBUG_SERVER | 2 |
DEBUG_CONNECTION | 3 |
DEBUG_LOWLEVEL | 4 |
Members
protected
- $error
—
array
Error information, if any, for the last SMTP command. - $helo_rply
—
string|null
The reply the server sent to us for HELO. - $last_reply
—
string
The most recent reply received from the server. - $server_caps
—
array|null
The set of SMTP extensions sent in reply to EHLO command. - $smtp_conn
—
resource
The socket for the server connection.
public
- $CRLF
—
string
SMTP reply line ending. - $Debugoutput
—
string|callable
How to handle debug output. - $SMTP_PORT
—
integer
SMTP server port number. - $Timelimit
—
integer
How long to wait for commands to complete, in seconds. - $Timeout
—
integer
The timeout value for connection, in seconds. - $Version
—
string
The PHPMailer SMTP Version number. - $do_debug
—
integer
Debug output level. - $do_verp
—
boolean
Whether to use VERP.
Methods
protected
- edebug() — Output debugging info via a user-selected method.
- get_lines() — Read the SMTP server's response.
- hmac() — Calculate an MD5 HMAC hash.
- parseHelloFields() — Parse a reply to HELO/EHLO command to discover server extensions.
- sendCommand() — Send a command to an SMTP server and check its return code.
- sendHello() — Send an SMTP HELO or EHLO command.
- setError() — Set error messages and codes.
public
- authenticate() — Perform SMTP authentication.
- client_send() — Send raw data to the server.
- close() — Close the socket and clean up the state of the class.
- connect() — Connect to an SMTP server.
- connected() — Check connection state.
- data() — Send an SMTP DATA command.
- getDebugLevel() — Get debug output level.
- getDebugOutput() — Get debug output method.
- getError() — Get the latest error.
- getLastReply() — Get the last reply from the server.
- getServerExt() — A multipurpose method The method works in three ways, dependent on argument value and current state 1.
- getServerExtList() — Get SMTP extensions available on the server
- getTimeout() — Get SMTP timeout.
- getVerp() — Get VERP address generation mode.
- hello() — Send an SMTP HELO or EHLO command.
- mail() — Send an SMTP MAIL command.
- noop() — Send an SMTP NOOP command.
- quit() — Send an SMTP QUIT command.
- recipient() — Send an SMTP RCPT command.
- reset() — Send an SMTP RSET command.
- sendAndMail() — Send an SMTP SAML command.
- setDebugLevel() — Set debug output level.
- setDebugOutput() — Set debug output method.
- setTimeout() — Set SMTP timeout.
- setVerp() — Enable or disable VERP address generation.
- startTLS() — Initiate a TLS (encrypted) session.
- turn() — Send an SMTP TURN command.
- verify() — Send an SMTP VRFY command.
History
-
2017-05-29T22:42:45+00:00 (commit #ba5872a)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
Core remastered to Bootstrap CSS framework.