@adonisjs/mail
Version:
Mail provider for adonis framework and has support for all common mailing services to send emails
64 lines (63 loc) • 1.7 kB
TypeScript
import { Mailer } from './mailer.js';
import { Message } from './message.js';
import { MailTransportContract, Recipient } from './types.js';
/**
* Class based emails are self contained dispatchable
* mail objects
*/
export declare abstract class BaseMail {
/**
* A flag to avoid build email message for
* multiple times
*/
protected built: boolean;
/**
* Reference to the mail message object
*/
message: Message;
/**
* Define the email subject
*/
subject?: string;
/**
* Define the from address for the email
*/
from?: Recipient;
/**
* Define the replyTo email address
*/
replyTo?: Recipient;
/**
* Defines the subject on the message using the mail
* class subject property
*/
protected defineSubject(): void;
/**
* Defines the from on the message using the mail
* class from property
*/
protected defineSender(): void;
/**
* Prepares the email message
*/
abstract prepare(): void | Promise<void>;
/**
* Builds the mail message for sending it
*/
build(): Promise<void>;
/**
* Builds the mail message with the email contents.
* This method will render the templates ahead of
* time
*/
buildWithContents(): Promise<void>;
/**
* Sends the mail
*/
send<T extends MailTransportContract>(mailer: Mailer<T>, config?: Parameters<T['send']>[1]): Promise<Awaited<ReturnType<T['send']>>>;
/**
* Sends the mail by using the background
* messenger
*/
sendLater<T extends MailTransportContract>(mailer: Mailer<T>, config?: Parameters<T['send']>[1]): Promise<void>;
}