On this page
Class SmtpTransport
Send mail using SMTP protocol
- AbstractTransport
- SmtpTransport 
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Network/Email/SmtpTransport.php
Properties summary
- 
    $_contentprotectedContent of email to returnstring
- 
    $_lastResponseprotectedThe response of the last sent SMTP command.array
- 
    Socket to SMTP server$_socketprotected
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 thefromemail address.
- 
    _prepareFromCmd() protectedPrepares theMAIL FROMSMTP command.
- 
    _prepareMessage() protectedPrepares the message body.
- 
    _prepareMessageHeaders() protectedPrepares the message headers.
- 
    _prepareRcptCmd() protectedPrepares theRCPT TOSMTP 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 $checkCodeoptional '250'
- Code to check for in server response, false to skip
Returns
string|nullThe matched code, or null if nothing matched
Throws
SocketExceptionconfig()source public
config( array $config null )Set the configuration
Parameters
- 
     array $configoptional 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
SocketExceptionMethods 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 $eoloptional "\r\n"
- End of line string.
Returns
stringProperties detail
© 2005–2017 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.
 https://api.cakephp.org/2.10/class-SmtpTransport.html