Class SmtpTransport

Send mail using SMTP protocol

AbstractTransport
Extended by SmtpTransport
Package: Cake\Network\Email
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Network/Email/SmtpTransport.php

Properties summary

Inherited Properties

Method Summary

Method Detail

_auth()source protected

_auth( )

Send authentication

Throws

SocketException

_bufferResponseLines()source protected

_bufferResponseLines( array $responseLines )

Parses and stores the reponse lines in 'code' => 'message' format.

Parameters

array $responseLines
Response lines to parse.

_connect()source protected

_connect( )

Connect to SMTP Server

Throws

SocketException

_disconnect()source protected

_disconnect( )

Disconnect

Throws

SocketException

_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|null
The 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

array
Returns 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

array

send()source public

send( CakeEmail $email )

Send mail

Parameters

CakeEmail $email
CakeEmail

Returns

array

Throws

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

string

Properties detail

$_contentsource

protected string

Content of email to return

$_lastResponsesource

protected array

The response of the last sent SMTP command.

array()

$_socketsource

protected CakeSocket

Socket to SMTP server

© 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