-
-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
I have nuxt config file
mail: {
message: {
to: process.env.NUXT_ADMIN_MAIL_USER,
},
smtp: {
host: 'smtp.mail.ru',
port: 465,
secure: true,
auth: {
user: process.env.NUXT_ADMIN_MAIL_USER,
pass: process.env.NUXT_ADMIN_MAIL_PASSWORD,
},
}
}
But, i want to send message to another recipient, not admin in nuxt config file. How can i do it? I have below my example code for sending. Can you please provide best practicies?
const { $mail } = useNuxtApp();
const from = useRuntimeConfig().public.adminMailUser
console.log($mail, 'mail')
try {
await $mail.send({
from: from,
subject: subject,
text: text,
message: {
to: to
}
})
}
catch (e) {
return {
error: e.message
}
}
Metadata
Metadata
Assignees
Labels
No labels