Class SmtpTransport
Send mail using SMTP protocol
- AbstractTransport
- SmtpTransport
Package: Cake\Network\Email
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Network/Email/SmtpTransport.php
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Network/Email/SmtpTransport.php
Properties summary
-
$_content
protectedstring
Content of email to return -
$_lastResponse
protectedarray
The response of the last sent SMTP command. -
$_socket
protectedSocket to SMTP server
Inherited Properties
Method Summary
-
_auth() protected
Send authentication -
_bufferResponseLines() protected
Parses and stores the reponse lines in'code' => 'message'
format. -
_connect() protected
Connect to SMTP Server -
_disconnect() protected
Disconnect -
_generateSocket() protected
Helper method to generate socket -
_prepareFromAddress() protected
Prepares thefrom
email address. -
_prepareFromCmd() protected
Prepares theMAIL FROM
SMTP command. -
_prepareMessage() protected
Prepares the message body. -
_prepareMessageHeaders() protected
Prepares the message headers. -
_prepareRcptCmd() protected
Prepares theRCPT TO
SMTP command. -
_prepareRecipientAddresses() protected
Prepares the recipient email addresses. -
_sendData() protected
Send Data -
_sendRcpt() protected
Send emails -
_smtpSend() protected
Protected method for sending data to SMTP connection -
config() public
Set the configuration -
getLastResponse() public
Returns the response of the last sent SMTP command. -
send() public
Send mail
Method Detail
_bufferResponseLines() protected ¶
_bufferResponseLines( array $responseLines )
Parses and stores the reponse lines in 'code' => 'message'
format.
Parameters
- array $responseLines
- Response lines to parse.
_prepareFromCmd() protected ¶
_prepareFromCmd( string $email )
Prepares the MAIL FROM
SMTP command.
Parameters
- string $email
- The email address to send with the command.
Returns
string
_prepareRcptCmd() protected ¶
_prepareRcptCmd( string $email )
Prepares the RCPT TO
SMTP command.
Parameters
- string $email
- The email address to send with the command.
Returns
string
_smtpSend() protected ¶
_smtpSend( string|null $data , string|boolean $checkCode = '250' )
Protected method for sending data to SMTP connection
Parameters
- string|null $data
- Data to be sent to SMTP server
- string|boolean $checkCode optional '250'
- Code to check for in server response, false to skip
Returns
string|null
The matched code, or null if nothing matched
The matched code, or null if nothing matched
Throws
config() public ¶
config( array $config = null )
Set the configuration
Parameters
- array $config optional null
- Configuration options.
Returns
array
Returns configs
Returns configs
Overrides
getLastResponse() public ¶
getLastResponse( )
Returns the response of the last sent SMTP command.
A response consists of one or more lines containing a response code and an optional response message text:
array( array( 'code' => '250', 'message' => 'mail.example.com' ), array( 'code' => '250', 'message' => 'PIPELINING' ), array( 'code' => '250', 'message' => '8BITMIME' ), // etc... )
Returns
array
Methods inherited from AbstractTransport
_headersToString() protected ¶
_headersToString( array $headers , string $eol = "\r\n" )
Help to convert headers in string
Parameters
- array $headers
- Headers in format key => value
- string $eol optional "\r\n"
- End of line string.
Returns
string