将 adonis 邮件数据发送到边缘视图
Send adonis mail data to the edge view
我想发送安排或变量进行迭代并进入我将在电子邮件中发送的视图。我正在使用 adonis.js,然后留下了我如何发送邮件的代码。
发送变量或安排并在视图中获取它们需要什么emails.test?
await Mail.send('emails.prueba', data, (message) => {
message
.from('myemail@.com')
.to(data.email)
.subject('Alerts')
})
首先您应该阅读 docs, it's all described there. So if you take a look at the Mail API 您可以将数据对象传递给视图。
await Mail.send('view', data, (message) => {
message
.from('')
.to('')
})
所以要将变量 foo
传递给视图,您会得到类似这样的东西
const foo = 'bar';
await Mail.send('emails.hello', foo, (message) => {
message
.from('')
.to('')
})
在您的 emails/hello.edge
模板中,您可以使用 {{ foo }}
调用此变量
我想发送安排或变量进行迭代并进入我将在电子邮件中发送的视图。我正在使用 adonis.js,然后留下了我如何发送邮件的代码。
发送变量或安排并在视图中获取它们需要什么emails.test?
await Mail.send('emails.prueba', data, (message) => {
message
.from('myemail@.com')
.to(data.email)
.subject('Alerts')
})
首先您应该阅读 docs, it's all described there. So if you take a look at the Mail API 您可以将数据对象传递给视图。
await Mail.send('view', data, (message) => {
message
.from('')
.to('')
})
所以要将变量 foo
传递给视图,您会得到类似这样的东西
const foo = 'bar';
await Mail.send('emails.hello', foo, (message) => {
message
.from('')
.to('')
})
在您的 emails/hello.edge
模板中,您可以使用 {{ foo }}