PHP Класс Tools\Mailer\Email

Наследование: extends Cake\Mailer\Email, use trait Cake\Log\LogTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_debug boolean | null
$_error string | null
$_log array
$_priority integer | null
$_wrapLength integer | null

Открытые методы

Метод Описание
__construct ( string | null $config = null )
addAttachment ( string $file, string | null $name = null, array $fileInfo = [] ) Add an attachment from file
addBlobAttachment ( string $content, string $filename, string | null $mimeType = null, array $fileInfo = [] ) Add an attachment as blob
addEmbeddedAttachment ( string $file, string | null $name = null, string | null $contentId = null, array $options = [] ) : string | $this Add an inline attachment from file
addEmbeddedBlobAttachment ( string $content, string $filename, string | null $mimeType = null, string | null $contentId = null, array $options = [] ) : string | $this Add an inline attachment as blob
attachments ( mixed | null $attachments = null ) : array | $this Overwrite to allow mimetype detection
getError ( ) : string Returns the error if existent
layout ( string | boolean $layout = false ) Change the layout
priority ( integer | null $priority = null ) : integer | $this Set/Get priority
profile ( mixed $config = null ) : string | null | $this Ovewrite to allow custom enhancements
reset ( ) : void EmailLib::resetAndSet()
send ( string | array | null $message = null ) : boolean Set the body of the mail as we send it.
validates ( ) : boolean Validate if the email has the required fields necessary to make send() work.
wrapLength ( integer | null $length = null ) : integer | $this Set/Get wrapLength

Защищенные методы

Метод Описание
_attachFiles ( string | null $boundary = null ) : array Attach non-embedded files by adding file contents inside boundaries.
_attachInlineFiles ( string | null $boundary = null ) : array Attach inline/embedded files to the message.
_getMime ( string $filename, string $default = 'application/octet-stream' ) : string Try to find mimetype by file extension
_getMimeByExtension ( string $ext, string $default = 'application/octet-stream' ) : mixed
_isEmbeddedAttachment ( string $file, string $name ) : boolean | string Returns if this particular file has already been attached as embedded file with this exact name to prevent the same image to overwrite each other and also to only send this image once.
_isEmbeddedBlobAttachment ( string $content, string $name ) : boolean | string Returns if this particular file has already been attached as embedded file with this exact name to prevent the same image to overwrite each other and also to only send this image once.
_logEmail ( string $level = LogLevel::INFO ) : void
_readFile ( string $path ) : string Read the file contents and return a base64 version of the file contents.
_wrap ( string $message, integer $wrapLength = CakeEmail::LINE_LENGTH_MUST ) : array Fix line length

Описание методов

__construct() публичный Метод

public __construct ( string | null $config = null )
$config string | null

_attachFiles() защищенный Метод

CUSTOM FIX: blob data support
protected _attachFiles ( string | null $boundary = null ) : array
$boundary string | null Boundary to use. If null, will default to $this->_boundary
Результат array An array of lines to add to the message

_attachInlineFiles() защищенный Метод

CUSTOM FIX: blob data support
protected _attachInlineFiles ( string | null $boundary = null ) : array
$boundary string | null Boundary to use. If null, will default to $this->_boundary
Результат array An array of lines to add to the message

_getMime() защищенный Метод

Try to find mimetype by file extension
protected _getMime ( string $filename, string $default = 'application/octet-stream' ) : string
$filename string File name
$default string default MimeType
Результат string Mimetype (falls back to `application/octet-stream`)

_getMimeByExtension() защищенный Метод

protected _getMimeByExtension ( string $ext, string $default = 'application/octet-stream' ) : mixed
$ext string
$default string
Результат mixed

_isEmbeddedAttachment() защищенный Метод

Allows multiple usage of the same embedded image (using the same cid)
protected _isEmbeddedAttachment ( string $file, string $name ) : boolean | string
$file string
$name string
Результат boolean | string CID of the found file or false if no such attachment can be found

_isEmbeddedBlobAttachment() защищенный Метод

Allows multiple usage of the same embedded image (using the same cid)
protected _isEmbeddedBlobAttachment ( string $content, string $name ) : boolean | string
$content string
$name string
Результат boolean | string CID of the found file or false if no such attachment can be found

_logEmail() защищенный Метод

protected _logEmail ( string $level = LogLevel::INFO ) : void
$level string
Результат void

_readFile() защищенный Метод

Overwrite parent to avoid File class and file_exists to false negative existent remove images. Also fixes file_get_contents (used via File class) to close the connection again after getting remote files. So far it would have kept the connection open in HTTP/1.1.
protected _readFile ( string $path ) : string
$path string The absolute path to the file to read.
Результат string File contents in base64 encoding

_wrap() защищенный Метод

Fix line length
protected _wrap ( string $message, integer $wrapLength = CakeEmail::LINE_LENGTH_MUST ) : array
$message string Message to wrap
$wrapLength integer
Результат array Wrapped message

addAttachment() публичный Метод

Add an attachment from file
public addAttachment ( string $file, string | null $name = null, array $fileInfo = [] )
$file string Absolute path
$name string | null
$fileInfo array

addBlobAttachment() публичный Метод

Add an attachment as blob
public addBlobAttachment ( string $content, string $filename, string | null $mimeType = null, array $fileInfo = [] )
$content string Blob data
$filename string to attach it
$mimeType string | null (leave it empty to get mimetype from $filename)
$fileInfo array

addEmbeddedAttachment() публичный Метод

Options: - mimetype - contentDisposition
public addEmbeddedAttachment ( string $file, string | null $name = null, string | null $contentId = null, array $options = [] ) : string | $this
$file string Absolute path
$name string | null (optional)
$contentId string | null (optional)
$options array Options
Результат string | $this CID or $this

addEmbeddedBlobAttachment() публичный Метод

Options: - contentDisposition
public addEmbeddedBlobAttachment ( string $content, string $filename, string | null $mimeType = null, string | null $contentId = null, array $options = [] ) : string | $this
$content string Blob data
$filename string to attach it
$mimeType string | null (leave it empty to get mimetype from $filename)
$contentId string | null (optional)
$options array Options
Результат string | $this $contentId or $this

attachments() публичный Метод

Overwrite to allow mimetype detection
public attachments ( mixed | null $attachments = null ) : array | $this
$attachments mixed | null
Результат array | $this

getError() публичный Метод

Returns the error if existent
public getError ( ) : string
Результат string

layout() публичный Метод

Change the layout
public layout ( string | boolean $layout = false )
$layout string | boolean Layout to use (or false to use none)

priority() публичный Метод

Set/Get priority
public priority ( integer | null $priority = null ) : integer | $this
$priority integer | null 1 (highest) to 5 (lowest)
Результат integer | $this

profile() публичный Метод

Ovewrite to allow custom enhancements
public profile ( mixed $config = null ) : string | null | $this
$config mixed
Результат string | null | $this

reset() публичный Метод

EmailLib::resetAndSet()
public reset ( ) : void
Результат void

send() публичный Метод

Note: the text can be an array, each element will appear as a seperate line in the message body. Do NOT pass a message if you use $this->set() in combination with templates
public send ( string | array | null $message = null ) : boolean
$message string | array | null Message
Результат boolean Success

validates() публичный Метод

Assumes layouting (does not check on content to be present or if view/layout files are missing).
public validates ( ) : boolean
Результат boolean Success

wrapLength() публичный Метод

Set/Get wrapLength
public wrapLength ( integer | null $length = null ) : integer | $this
$length integer | null Must not be more than CakeEmail::LINE_LENGTH_MUST
Результат integer | $this

Описание свойств

$_debug защищенное свойство

protected bool|null $_debug
Результат boolean | null

$_error защищенное свойство

protected string|null $_error
Результат string | null

$_log защищенное свойство

protected array $_log
Результат array

$_priority защищенное свойство

protected int|null $_priority
Результат integer | null

$_wrapLength защищенное свойство

protected int|null $_wrapLength
Результат integer | null