PHP Класс Webiny\Component\Mailer\Mailer

This class provides access to mail Transport and mail Message object. Use the getMessage to create an email message, and then use the send method to send it using the Transport object.
Наследование: use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\StdLib\ComponentTrait
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( string $mailer = 'Default' ) Base constructor.
getMessage ( array | ArrayObject | ConfigObject $config = null ) : Webiny\Component\Mailer\MessageInterface Creates a new message.
getTransport ( ) : Webiny\Component\Mailer\TransportInterface Returns the current transport instance.
send ( Webiny\Component\Mailer\MessageInterface $message, null | array &$failures = null ) : boolean | integer Sends the message.
setDecorators ( array $replacements ) Decorators are arrays that contain keys and values. The message body and subject will be scanned for the keys, and, where found, the key will be replaced with the value.

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

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

Base constructor.
public __construct ( string $mailer = 'Default' )
$mailer string Key of the mailer configuration.

getMessage() публичный метод

Creates a new message.
public getMessage ( array | ArrayObject | ConfigObject $config = null ) : Webiny\Component\Mailer\MessageInterface
$config array | Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject | Webiny\Component\Config\ConfigObject (Optional)
Результат Webiny\Component\Mailer\MessageInterface

getTransport() публичный метод

Returns the current transport instance.
public getTransport ( ) : Webiny\Component\Mailer\TransportInterface
Результат Webiny\Component\Mailer\TransportInterface

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

Sends the message.
public send ( Webiny\Component\Mailer\MessageInterface $message, null | array &$failures = null ) : boolean | integer
$message Webiny\Component\Mailer\MessageInterface Message you want to send.
$failures null | array To this array failed addresses will be stored.
Результат boolean | integer Number of success sends, or bool FALSE if sending failed.

setDecorators() публичный метод

Decorators are arrays that contain keys and values. The message body and subject will be scanned for the keys, and, where found, the key will be replaced with the value.
public setDecorators ( array $replacements )
$replacements array Array [email=> [key1=>value1, key2=>value2], email2=>[...]].