Class SmtpTransport

Send mail using SMTP protocol

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

Method Detail

_authsource protected

_auth( )

Send authentication

Throws

SocketException
SocketException

_bufferResponseLinessource protected

_bufferResponseLines( array $responseLines )

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

Parameters

array $responseLines
Response lines to parse.

_connectsource protected

_connect( )

Connect to SMTP Server

Throws

SocketException
SocketException

_disconnectsource protected

_disconnect( )

Disconnect

Throws

SocketException
SocketException

_generateSocketsource protected

_generateSocket( )

Helper method to generate socket

Throws

SocketException
SocketException

_prepareFromAddresssource protected

_prepareFromAddress( )

Prepares the from email address.

Returns

array
array

_prepareFromCmdsource protected

_prepareFromCmd( string $email )

Prepares the MAIL FROM SMTP command.

Parameters

string $email
The email address to send with the command.

Returns

string
string

_prepareMessagesource protected

_prepareMessage( )

Prepares the message body.

Returns

string
string

_prepareMessageHeaderssource protected

_prepareMessageHeaders( )

Prepares the message headers.

Returns

array
array

_prepareRcptCmdsource protected

_prepareRcptCmd( string $email )

Prepares the RCPT TO SMTP command.

Parameters

string $email
The email address to send with the command.

Returns

string
string

_prepareRecipientAddressessource protected

_prepareRecipientAddresses( )

Prepares the recipient email addresses.

Returns

array
array

_sendDatasource protected

_sendData( )

Send Data

Throws

SocketException
SocketException

_sendRcptsource protected

_sendRcpt( )

Send emails

Throws

SocketException
SocketException

_smtpSendsource 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
SocketException

configsource public

config( array $config null )

Set the configuration

Parameters

array $config optional null
Configuration options.

Returns

array
Returns configs

Overrides

AbstractTransport::config()

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

sendsource public

send( CakeEmail $email )

Send mail

Parameters

CakeEmail $email
CakeEmail

Returns

array
array

Throws

SocketException
SocketException

Methods inherited from AbstractTransport

_headersToStringsource 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
string

Properties summary

$_cakeEmailsource

protected CakeEmail

CakeEmail

$_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

Properties inherited from AbstractTransport

$_configsource

protected array

Configurations

array()

© 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.7/class-SmtpTransport.html