Skip to content

Commit

Permalink
Merge pull request #200 from AthennaIO/develop
Browse files Browse the repository at this point in the history
feat(mail): add tip about overwriting view values
  • Loading branch information
jlenon7 authored Mar 7, 2024
2 parents 037023e + c742b93 commit 92fc984
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/digging-deeper/mail.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
<!-- Provided by you also but using Mail facade -->
<!-- Provided by you when using Mail facade methods -->
<h1>{{ to }}</h1>
<h1>{{ cc }}</h1>
<h1>{{ bcc }}</h1>
<h1>{{ from }}</h1>
<h1>{{ content }}</h1>

<!-- Provided by you in second argument -->
<!-- Provided by you second argument -->
<h1>{{ email }}</h1>
```

:::tip

You can overwrite data set by `Mail` facade by defining it
in the second argument object:

```typescript
const userEmail = '[email protected]'

await Mail.from('[email protected]')
.to(userEmail)
.cc('[email protected], [email protected]')
.bcc('[email protected], [email protected]')
.content('This is the mail body')
.view('mail/welcome', {
email: userEmail,
to: '[email protected]' 👈
})
.send()
```

:::

### Previewing mail templates in the browser

When designing a mailable's template, it is convenient to quickly
Expand Down

0 comments on commit 92fc984

Please sign in to comment.