interface DriverInterface

An interface for a mail service.

This interface provides all methods necessary for configuring, checking and using one of Laravel's various email drivers throughout Flarum.

Methods

array
availableSettings()

Provide a list of settings for this driver.

MessageBag
validate(SettingsRepositoryInterface $settings, Factory $validator)

Ensure the given settings are enough to send emails.

bool
canSend()

Does this driver actually send out emails?

Swift_Transport
buildTransport(SettingsRepositoryInterface $settings)

Build a mail transport based on Flarum's current settings.

Details

array availableSettings()

Provide a list of settings for this driver.

The list must be an array of field names (keys) mapping to their type (the empty string "" for a text field; or an array of possible values for a dropdown field).

Return Value

array

MessageBag validate(SettingsRepositoryInterface $settings, Factory $validator)

Ensure the given settings are enough to send emails.

This method is responsible for determining whether the user-provided values stored in Flarum's settings are "valid" as far as a simple inspection of these values can determine it. Of course, this does not mean that the mail server or API will actually accept e.g. credentials. Any errors must be wrapped in a {\Illuminate\Support\MessageBag}. If there are no errors, an empty instance can be returned. In the presence of validation problems with the configured mail driver, Flarum will fall back to its no-op {\Flarum\Mail\NullDriver}.

Parameters

SettingsRepositoryInterface $settings
Factory $validator

Return Value

MessageBag

bool canSend()

Does this driver actually send out emails?

Return Value

bool

Swift_Transport buildTransport(SettingsRepositoryInterface $settings)

Build a mail transport based on Flarum's current settings.

Parameters

SettingsRepositoryInterface $settings

Return Value

Swift_Transport