/ cake / libs / controller / components / email.php

Defined Classes

EmailComponent Class Info:

Class Declaration:

class EmailComponent extends Object

File name:
cake/libs/controller/components/email.php
Description:

EmailComponent

This component is used for handling Internet Message Format based based on the standard outlined in http://www.rfc-editor.org/rfc/rfc2822.txt

Class Inheritance

Object

Properties:

Show/Hide parent properties
  • additionalParams string

    List of additional headers

    These will NOT be used if you are using safemode and mail()

  • attachments array

    List of files that should be attached to the email.

    Can be both absolute and relative paths

  • bcc array

    Blind Carbon Copy

    List of email's that should receive a copy of the email. The Recipient WILL NOT be able to see this list

  • cc array

    Carbon Copy

    List of email's that should receive a copy of the email. The Recipient WILL be able to see this list

  • charset string

    charset the email is sent in

  • date string

    The date to put in the Date: header. This should be a date conformant with the RFC2822 standard. Leave null, to have today's date generated.

  • delivery string

    What method should the email be sent by

    Supported methods: - mail - smtp - debug

  • filePaths array

    The list of paths to search if an attachment isnt absolute

  • from string

    The mail which the email is sent from

  • headers array

    Associative array of a user defined headers Keys will be prefixed 'X-' as per RFC2822 Section 4.7.5

  • htmlMessage string

    Contains the rendered HTML message if one was sent.

  • layout string

    Layout for the View

  • lineFeed string

    Line feed character(s) to be used when sending using mail() function By default PHP_EOL is used. RFC2822 requires it to be CRLF but some Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used).

  • _lineLength

  • lineLength integer

    as per RFC2822 Section 2.1.1

  • messageId mixed

    Whether to generate a Message-ID header for the e-mail. True to generate a Message-ID, False to let it be handled by sendmail (or similar) or a string to completely override the Message-ID.

    If you are sending Email from a shell, be sure to set this value. As you could encounter delivery issues if you do not.

  • readReceipt string

    The read receipt email

  • replyTo string

    The email the recipient will reply to

  • return string

    The mail that will be used in case of any errors like - Remote mailserver down - Remote user has exceeded his quota - Unknown user

  • sendAs string

    What format should the email be sent in

    Supported formats: - text - html - both

  • smtpError string

    Placeholder for any errors that might happen with the smtp mail methods

  • smtpOptions array

    List of options to use for smtp mail method

    Options is: - port - host - timeout - username - password - client

  • subject string

    The subject of the email

  • template string

    Template for the view

  • textMessage string

    Contains the rendered plain text message if one was sent.

  • to string

    Recipient of the email

  • xMailer string

    What mailer should EmailComponent identify itself as

cakeError

top

Used to report user friendly errors. If there is a file app/error.php or app/app_error.php this file will be loaded error.php is the AppError class it should extend ErrorHandler class.

Parameters:
  • string $method required

    Method to be called in the error class (AppError or ErrorHandler classes)

  • array $messages optional array ( )

    Message that is to be displayed by the error class

Method defined in:
cake/libs/object.php on line 187
Return

error message

Access

public

__construct

top

Class constructor, overridden in descendant classes.

Method defined in:
cake/libs/object.php on line 54

dispatchMethod

top

Calls a method on this object with the given parameters. Provides an OO wrapper for call_user_func_array

Parameters:
  • string $method required

    Name of the method to call

  • array $params optional array ( )

    Parameter list to use when calling $method

Method defined in:
cake/libs/object.php on line 107
Return

mixed Returns the result of the method call

Access

public

_getSocket

top

Helper method to get socket, overridden in tests

Parameters:
  • array $config required

    Config data for the socket.

Method defined in:
cake/libs/controller/components/email.php on line 843
Return

void

Access

protected

header

top

Sets headers for the message

Parameters:
  • $headers required

Method defined in:
cake/libs/controller/components/email.php on line 549
Access

public

initialize

top

Initialize component

Parameters:
  • object $controller required

    Instantiating controller

  • $settings optional array ( )

Method defined in:
cake/libs/controller/components/email.php on line 331
Access

public

log

top

Convience method to write a message to CakeLog. See CakeLog::write() for more information on writing to logs.

Parameters:
  • string $msg required

    Log message

  • integer $type optional 2

    Error type constant. Defined in app/config/core.php.

Method defined in:
cake/libs/object.php on line 148
Return

boolean Success of log write

Access

public

Object

top

A hack to support __construct() on PHP 4 Hint: descendant classes have no PHP4 class_name() constructors, so this constructor gets called first and calls the top-layer __construct() which (if present) should call parent::__construct()

Method defined in:
cake/libs/object.php on line 43
Return

Object

_persist

top

Checks for a persistent class file, if found file is opened and true returned If file is not found a file is created and false returned If used in other locations of the model you should choose a unique name for the persistent file There are many uses for this method, see manual for examples

Parameters:
  • string $name required

    name of the class to persist

  • $return required

  • string $object required

    the object to persist

  • $type optional NULL

Method defined in:
cake/libs/object.php on line 218
Return

boolean Success

Access

protected

Todo

add examples to manual

requestAction

top

Calls a controller's method from any location. Can be used to connect controllers together or tie plugins into a main application. requestAction can be used to return rendered views or fetch the return value from controller actions.

Parameters:
  • mixed $url required

    String or array-based url.

  • array $extra optional array ( )

    if array includes the key "return" it sets the AutoRender to true.

Method defined in:
cake/libs/object.php on line 80
Return

mixed Boolean true or false on success/failure, or contents of rendered action if 'return' is set in $extra.

Access

public

reset

top

Reset all EmailComponent internal variables to be able to send out a new email.

Method defined in:
cake/libs/controller/components/email.php on line 424

_savePersistent

top

You should choose a unique name for the persistent file

There are many uses for this method, see manual for examples

Parameters:
  • string $name required

    name used for object to cache

  • object $object required

    the object to persist

Method defined in:
cake/libs/object.php on line 247
Return

boolean true on save, throws error if file can not be created

Access

protected

send

top

Send an email using the specified content, template and layout

Parameters:
  • mixed $content optional NULL

    Either an array of text lines, or a string with contents If you are rendering a template this variable will be sent to the templates as $content

  • string $template optional NULL

    Template to use when sending email

  • string $layout optional NULL

    Layout to use to enclose email body

Method defined in:
cake/libs/controller/components/email.php on line 357
Return

boolean Success

Access

public

_set

top

Allows setting of multiple properties of the object in a single line of code. Will only set properties that are part of a class declaration.

Parameters:
  • array $properties optional array ( )

    An associative array containing properties and corresponding values.

Method defined in:
cake/libs/object.php on line 166
Return

void

Access

protected

_smtpSend

top

Protected method for sending data to SMTP connection

Parameters:
  • string $data required

    data to be sent to SMTP server

  • mixed $checkCode optional '250'

    code to check for in server response, false to skip

Method defined in:
cake/libs/controller/components/email.php on line 949
Return

bool Success

Access

protected

startup

top

Startup component

Parameters:
  • object $controller required

    Instantiating controller

Method defined in:
cake/libs/controller/components/email.php on line 345
Access

public

_stop

top

Stop execution of the current script. Wraps exit() making testing easier.

Parameters:
  • $status optional 0

Method defined in:
cake/libs/object.php on line 135
Return

void

Access

public

toString

top

Object-to-string conversion. Each class can override this method as necessary.

Method defined in:
cake/libs/object.php on line 64
Return

string The name of this class

Access

public

_wrap

top

Wrap the message using EmailComponent::$lineLength

Parameters:
  • string $message required

    Message to wrap

  • integer $lineLength optional NULL

    Max length of line

Method defined in:
cake/libs/controller/components/email.php on line 720
Return

array Wrapped message

Access

protected