CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.9 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.9
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper
  • None

Classes

  • AbstractTransport
  • CakeEmail
  • DebugTransport
  • MailTransport
  • SmtpTransport

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
Location: Cake/Network/Email/SmtpTransport.php

Properties summary

  • $_content protected
    string
    Content of email to return
  • $_lastResponse protected
    array
    The response of the last sent SMTP command.
  • $_socket protected
    CakeSocket
    Socket to SMTP server

Inherited Properties

  • _config

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 the from email address.
  • _prepareFromCmd() protected
    Prepares the MAIL FROM SMTP command.
  • _prepareMessage() protected
    Prepares the message body.
  • _prepareMessageHeaders() protected
    Prepares the message headers.
  • _prepareRcptCmd() protected
    Prepares the RCPT 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

_auth() protected ¶

_auth( )

Send authentication

Throws
SocketException

_bufferResponseLines() protected ¶

_bufferResponseLines( array $responseLines )

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

Parameters
array $responseLines
Response lines to parse.

_connect() protected ¶

_connect( )

Connect to SMTP Server

Throws
SocketException

_disconnect() protected ¶

_disconnect( )

Disconnect

Throws
SocketException

_generateSocket() protected ¶

_generateSocket( )

Helper method to generate socket

Throws
SocketException

_prepareFromAddress() protected ¶

_prepareFromAddress( CakeEmail $email )

Prepares the from email address.

Parameters
CakeEmail $email
CakeEmail
Returns
array

_prepareFromCmd() protected ¶

_prepareFromCmd( string $email )

Prepares the MAIL FROM SMTP command.

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

_prepareMessage() protected ¶

_prepareMessage( CakeEmail $email )

Prepares the message body.

Parameters
CakeEmail $email
CakeEmail
Returns
string

_prepareMessageHeaders() protected ¶

_prepareMessageHeaders( CakeEmail $email )

Prepares the message headers.

Parameters
CakeEmail $email
CakeEmail
Returns
array

_prepareRcptCmd() protected ¶

_prepareRcptCmd( string $email )

Prepares the RCPT TO SMTP command.

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

_prepareRecipientAddresses() protected ¶

_prepareRecipientAddresses( CakeEmail $email )

Prepares the recipient email addresses.

Parameters
CakeEmail $email
CakeEmail
Returns
array

_sendData() protected ¶

_sendData( CakeEmail $email )

Send Data

Parameters
CakeEmail $email
CakeEmail
Throws
SocketException

_sendRcpt() protected ¶

_sendRcpt( CakeEmail $email )

Send emails

Parameters
CakeEmail $email
CakeEmail
Throws
SocketException

_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
Throws
SocketException

config() public ¶

config( array $config = null )

Set the configuration

Parameters
array $config optional null
Configuration options.
Returns
array
Returns configs
Overrides
AbstractTransport::config()

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

send() public ¶

send( CakeEmail $email )

Send mail

Parameters
CakeEmail $email
CakeEmail
Returns
array
Throws
SocketException

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

Properties detail

$_content ¶

protected string

Content of email to return

$_lastResponse ¶

protected array

The response of the last sent SMTP command.

array()

$_socket ¶

protected CakeSocket

Socket to SMTP server

OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs