MailerHelper ​
- Type
- Class
- Namespace
- craft\helpers
- Inherits
- craft\helpers\MailerHelper
- Since
- 3.0.0
Class MailerHelper
Public Methods ​
Method | Description |
---|---|
allMailerTransportTypes() | Returns all available mailer transport adapter classes. |
createTransportAdapter() | Creates a transport adapter based on the given mail settings. |
normalizeEmails() | Normalizes To/From/CC/BCC values into an array of email addresses, or email/name pairs. |
settingsReport() | Returns a report of the settings used for the given Mailer instance. |
allMailerTransportTypes()
​
Returns all available mailer transport adapter classes.
Returns ​
string[]
createTransportAdapter()
​
Creates a transport adapter based on the given mail settings.
Arguments ​
Returns ​
\craft\helpers\T
Throws ​
- craft\errors\MissingComponentException
if $type is missing
normalizeEmails()
​
- Since
- 3.5.0
Normalizes To/From/CC/BCC values into an array of email addresses, or email/name pairs.
Arguments ​
$emails
(string, array, craft\elements\User, craft\elements\User[], null)
Returns ​
settingsReport()
​
- Since
- 3.5.0
Returns a report of the settings used for the given Mailer instance.
Arguments ​
$mailer
(craft\mail\Mailer)$transportAdapter
(craft\mail\transportadapters\TransportAdapterInterface, null)
Returns ​
Events ​
EVENT_REGISTER_MAILER_TRANSPORT_TYPES ​
The event that is triggered when registering mailer transport adapter types.
Mailer transports must implement craft\mail\transportadapters\TransportAdapterInterface. craft\mail\transportadapters\BaseTransportAdapter provides a base implementation.
Example ​
php
use craft\events\RegisterComponentTypesEvent;
use craft\helpers\MailerHelper;
use yii\base\Event;
Event::on(MailerHelper::class,
MailerHelper::EVENT_REGISTER_MAILER_TRANSPORT_TYPES,
function(RegisterComponentTypesEvent $event) {
$event->types[] = MyTransportType::class;
}
);