Mail class
Mail facade for convenient access to mail functionality.
Provides static methods for sending emails.
Example:
// Send simple email
await Mail.to('user@example.com')
.subject('Welcome!')
.text('Welcome to our app')
.send();
// Send with view
await Mail.to('user@example.com')
.subject('Welcome!')
.view('emails.welcome', {'name': 'John'})
.send();
// Send mailable
await Mail.send(WelcomeMail(user));
// Queue mailable
await Mail.queue(WelcomeMail(user));
Constructors
- Mail()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- manager → MailManager
-
Gets the mail manager instance.
no setter
-
transports
→ List<
String> -
Gets list of available transports.
no setter
Static Methods
-
attach(
String path, {String? name, String? mimeType}) → MailerInterface - Attaches a file.
-
attachData(
List< int> data, String name, {String? mimeType}) → MailerInterface - Attaches raw data.
-
bcc(
dynamic addresses) → MailerInterface - Sets the BCC recipient(s).
-
cc(
dynamic addresses) → MailerInterface - Sets the CC recipient(s).
-
embed(
String path, String cid) → MailerInterface - Embeds an inline image.
-
from(
String address, [String? name]) → MailerInterface - Sets the sender (from address).
-
header(
String name, String value) → MailerInterface - Sets a custom header.
-
html(
String content) → MailerInterface - Sets the HTML body.
-
mailer(
[String? name]) → MailerInterface - Gets a mailer instance.
-
priority(
int priority) → MailerInterface - Sets the email priority.
-
queue(
Mailable mailable, [Duration? delay]) → Future< void> - Queues a mailable.
-
replyTo(
String address, [String? name]) → MailerInterface - Sets the reply-to address.
-
send(
Mailable mailable) → Future< bool> - Sends a mailable.
-
subject(
String subject) → MailerInterface - Sets the email subject.
-
test(
[String? transport]) → Future< bool> - Tests a transport connection.
-
text(
String content) → MailerInterface - Sets the plain text body.
-
to(
dynamic addresses) → MailerInterface - Sets the recipient(s) of the email.
-
view(
String viewName, [Map< String, dynamic> ? data]) → Future<MailerInterface> - Renders a view template for the email body.