Class SmtpTransport
Send mail using SMTP protocol
- AbstractTransport
- SmtpTransport
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Network/Email/SmtpTransport.php
Properties summary
-
$_content
protectedstring
-
$_lastResponse
protectedarray
-
$_socket
protected
Inherited Properties
Method Summary
-
_auth() protectedSend authentication
-
_bufferResponseLines() protectedParses and stores the reponse lines in
'code' => 'message'
format. -
_connect() protectedConnect to SMTP Server
-
_disconnect() protectedDisconnect
-
_generateSocket() protectedHelper method to generate socket
-
_prepareFromAddress() protectedPrepares the
from
email address. -
_prepareFromCmd() protectedPrepares the
MAIL FROM
SMTP command. -
_prepareMessage() protectedPrepares the message body.
-
_prepareMessageHeaders() protectedPrepares the message headers.
-
_prepareRcptCmd() protectedPrepares the
RCPT TO
SMTP command. -
_prepareRecipientAddresses() protectedPrepares the recipient email addresses.
-
_sendData() protectedSend Data
-
_sendRcpt() protectedSend emails
-
_smtpSend() protectedProtected method for sending data to SMTP connection
-
config() publicSet the configuration
-
getLastResponse() publicReturns the response of the last sent SMTP command.
-
send() publicSend mail
Method Detail
_bufferResponseLines()source protected
_bufferResponseLines( array $responseLines )
Parses and stores the reponse lines in 'code' => 'message'
format.
Parameters
-
array
$responseLines
- Response lines to parse.
_generateSocket()source protected
_generateSocket( )
Helper method to generate socket
Throws
SocketException
_prepareFromAddress()source protected
_prepareFromAddress( CakeEmail $email )
Prepares the from
email address.
Parameters
-
CakeEmail
$email
- CakeEmail
Returns
array_prepareFromCmd()source protected
_prepareFromCmd( string $email )
Prepares the MAIL FROM
SMTP command.
Parameters
-
string
$email
- The email address to send with the command.
Returns
string_prepareMessage()source protected
_prepareMessage( CakeEmail $email )
Prepares the message body.
Parameters
-
CakeEmail
$email
- CakeEmail
Returns
string_prepareMessageHeaders()source protected
_prepareMessageHeaders( CakeEmail $email )
Prepares the message headers.
Parameters
-
CakeEmail
$email
- CakeEmail
Returns
array_prepareRcptCmd()source protected
_prepareRcptCmd( string $email )
Prepares the RCPT TO
SMTP command.
Parameters
-
string
$email
- The email address to send with the command.
Returns
string_prepareRecipientAddresses()source protected
_prepareRecipientAddresses( CakeEmail $email )
Prepares the recipient email addresses.
Parameters
-
CakeEmail
$email
- CakeEmail
Returns
array_sendData()source protected
_sendData( CakeEmail $email )
Send Data
Parameters
-
CakeEmail
$email
- CakeEmail
Throws
SocketException
_sendRcpt()source protected
_sendRcpt( CakeEmail $email )
Send emails
Parameters
-
CakeEmail
$email
- CakeEmail
Throws
SocketException
_smtpSend()source 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|nullThe matched code, or null if nothing matched
Throws
SocketException
config()source public
config( array $config null )
Set the configuration
Parameters
-
array
$config
optional null - Configuration options.
Returns
arrayReturns configs
Overrides
AbstractTransport::config()
getLastResponse()source 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
arraysend()source public
send( CakeEmail $email )
Send mail
Parameters
-
CakeEmail
$email
- CakeEmail
Returns
arrayThrows
SocketException
Methods inherited from AbstractTransport
_headersToString()source 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
stringProperties detail
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.8/class-SmtpTransport.html