sendMailable method

  1. @override
Future<bool> sendMailable(
  1. Mailable mailable
)
override

Sends a Mailable instance.

Example:

await mailer.sendMailable(WelcomeMail(user));

Implementation

@override
Future<bool> sendMailable(Mailable mailable) async {
  try {
    await mailable.beforeSend();

    // Build the mail using the mailable
    await mailable.build(this);

    // Send the email
    final result = await send();

    if (result) {
      await mailable.afterSend();
    }

    return result;
  } catch (e, stack) {
    await mailable.onError(e, stack);
    rethrow;
  }
}