PHP Class 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.
Inheritance: use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\StdLib\ComponentTrait
Exibir arquivo Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
__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.

Method Details

__construct() public method

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

getMessage() public method

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)
return Webiny\Component\Mailer\MessageInterface

getTransport() public method

Returns the current transport instance.
public getTransport ( ) : Webiny\Component\Mailer\TransportInterface
return Webiny\Component\Mailer\TransportInterface

send() public method

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.
return boolean | integer Number of success sends, or bool FALSE if sending failed.

setDecorators() public method

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=>[...]].