Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 719 Bytes

File metadata and controls

28 lines (19 loc) · 719 Bytes

Registering provider

The provider is registered inside start/app.js file under providers array.

const providers = [
  '@adonisjs/mail/providers/MailProvider'
]

That's all! Now you can use the mail provider as follows.

const Mail = use('Mail')

await Mail.send('emails.welcome', {}, (message) => {
  message.from('foo@bar.com')
  message.to('bar@baz.com')
})

The welcome is the view name stored inside the resources/views/emails directory.

Configuration and Environment variables

The configuration file is saved as config/mail.js, feel free to tweak it according.

Also make sure to define sensitive driver details inside the .env file and reference them via Env provider.