nuxt-mail
Version:
Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
17 lines • 382 B
JavaScript
import { defineNuxtPlugin } from "#imports";
export default defineNuxtPlugin(() => ({
provide: {
mail: {
send: async config => {
try {
await $fetch("/mail/send", {
body: config,
method: "POST"
});
} catch (error) {
throw new Error(error.response._data.statusMessage);
}
}
}
}
}));