From c742b9372952b93ff95e1ce0c445b9671a350eed Mon Sep 17 00:00:00 2001 From: jlenon7 Date: Thu, 7 Mar 2024 12:51:24 +0000 Subject: [PATCH] feat(mail): add tip about overwriting view values --- docs/digging-deeper/mail.mdx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/digging-deeper/mail.mdx b/docs/digging-deeper/mail.mdx index cbb14891..7d04d28f 100644 --- a/docs/digging-deeper/mail.mdx +++ b/docs/digging-deeper/mail.mdx @@ -151,17 +151,39 @@ Any data that you provide using the `Mail` facade will be available to you in your view: ```html title="Path.views('mail/welcome.edge')" - +

{{ to }}

{{ cc }}

{{ bcc }}

{{ from }}

{{ content }}

- +

{{ email }}

``` +:::tip + +You can overwrite data set by `Mail` facade by defining it +in the second argument object: + +```typescript +const userEmail = 'lenon@athenna.io' + +await Mail.from('support@athenna.io') + .to(userEmail) + .cc('mailer1@athenna.io, mailer2@athenna.io') + .bcc('mailer3@athenna.io, mailer4@athenna.io') + .content('This is the mail body') + .view('mail/welcome', { + email: userEmail, + to: 'txsoura@athenna.io' 👈 + }) + .send() +``` + +::: + ### Previewing mail templates in the browser When designing a mailable's template, it is convenient to quickly