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
Afficher le fichier Open project: Webiny/Framework Class Usage Examples

Méthodes publiques

Méthode 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 méthode

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

getMessage() public méthode

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)
Résultat Webiny\Component\Mailer\MessageInterface

getTransport() public méthode

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

send() public méthode

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

setDecorators() public méthode

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