# Mailing

Miru has some Mailing facilities on top of FluentEmail.

# Create

An easy way to create a Mailable and an email template is using a Maker from MiruCli:

miru make:mail Accounts Account Created

# Mailable

A Mailable is the object that will be passed to the Sender or to the Queue. It has the email properties like subject, body, sender, receiver, and etc.

Not Found: D:\Projects\Miru/samples/Mong/src/Mong/Features/Accounts/AccountRegisteredMail.cs

# Template

The Template is a Razor file that will be transformed into html before send the email. Markdown can be used between the tags <markdown></markdown>.

Not Found: D:\Projects\Miru/samples/Mong/src/Mong/Features/Accounts/AccountRegisteredMail.cshtml

# Sending

Send email is done using Miru.Mailing.IMailer:

var user = _db.Users.ById(id);

// send now synchronously
await _mailer.SendNowAsync(new AccountRegisteredMail(user));

// queue to send asynchronously
await _mailer.SendLaterAsync(new AccountRegisteredMail(user));