Mails

Writing Mails

Name & Slug

Each mail you create must have a name and a slug. The name let's you identify the mail quickly, for example in the mail log. The slug is important to reference the mail in code, for example to send the mail in a Livewire component (see further).

Sender

You must choose a sender for the mail to use in its From headers. You can only choose from a list of verified senders you create in the settings. Take a look at the Senders section for more information.

Parameters

Parameters can be used to make mails more dynamic. You can pass different values to the parameters each time you send the mail. Parameters can be inserted as placeholders in the subject and body.

Subject

For each language, you can enter a subject for the mail. Parameters can be inserted by typing @ in the subject field.

Body

For the body of the mail, you have 3 options.

Rich Text

This type of body let's you enter the body text for each language, without the need for coding. It can be used for simple mails that don't need much layout. Parameters can be inserted by typing @ in the subject field.

Blade

When you choose this body type, you can select a Blade view that must be rendered as the mail body. In the view, you can use the $parameters variable to insert parameter values:

Name: {{ $parameters['name'] }}

Take a look at the Blade Mail snippet for a complete example.

Markdown

This body type let's you select a Blade view, just as the previous type, instead it will be processed as Markdown. It uses the Markdown Mailables from Laravel behind the scenes, which give you an easy way to build beautiful, responsive mails while also automatically generating a plain-text counterpart.

Take a look at the Markdown Mail snippet for a complete example.

Previewing

You can preview the mail you're building without needing the send it to yourself over and over again. Just right-click on a mail and choose Open in Preview to open the mail in the preview panel. If the mail has parameters, they will get their default value when previewing the mail.

Sending Mails

Sending Manually

Right-click a mail and choose Send Test to open the test form. You can choose the language, the recipients, and the parameter values. Clicking Send will send the mail immediately to the specified recipients. When there occurs an error sending the mail, an error message box will be shown. The test mail will also appear in the mail log, just like any other sending of the mail.

All the test data you enter is saved and will be refilled automatically the next time you send a test. This way, you don't have to enter the same values over and over again when testing your mail.

Sending from Livewire

The only way to send a mail programatically in Devisto, is in a Livewire component. Use the mail() helper to access the mail and send it:

mail('subscription')
    ->to('name@example.com')
    ->cc('info@devisto.com')
    ->bcc('klaas@devisto.com')
    ->replyTo('klaas@devisto.com')
    ->parameter('name', $this->name)
    ->parameters(['name' => $this->name])
    ->send();

// to(), cc() and bcc() accept one or multiple addresses
->to('klaas@devisto.com')
->to('klaas@devisto.com, info@devisto.com')
->to(['klaas@devisto.com', 'info@devisto.com'])

Mail Log

Click the Log tab to get an overview of what happened with your mails. Every single submission of a mail is shown here, along with its status. If an error ocurred, you can click the status badge to see the error detail. In the upper right corner, you can filter the list for a specific mail.

Previous topic
← Assets
Next topic
Senders →