Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually inspired by react-email, it allows us develop themes using the vue platform, with parts that help our company construct templates quickly and also quick.To begin utilizing vue-email in any vue task, you only need to have to mount the plan:.Along with NPM:.$ npm put up vue-email.Along with Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm put up vue-email.Developing email template.Create a brand new e-mail template in anywhere you wish to possess your themes, for this situation, our team may generate a layout directory, along with a template phoned welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue part library for structure receptive emails.Perspective on GitHub.Satisfied coding!David Arenas.
Providing the templates.Our experts can make use of the leave feature, it acquires two params, the very first one is actually the template to make, and also the second the params to become used for the layout, and afterwards pass the outcome layout in the body of ask for.Passing the theme in the body system, provide us the possibility of leaving utilizing any server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email along with nodemailer.Dispatched email.
Send out email.Within this instance i making use of nuxt v3 given that it allows our team to prepare api inside very own venture, and specify several api courses.Listed here our team just remove the design template of the request body system, and also deliver the e-mail passing the layout in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const physical body = await readBody( event).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( bunch: process.env.HOST ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there globe',.html: body.template,..await transporter.sendMail( options). ).If you are actually certainly not making use of the server in nuxt, you can simply apply on any kind of framework as an example using reveal:.import express coming from 'convey'.bring in nodemailer coming from 'nodemailer'.const app = express().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( host: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there globe',.html: design template,..await transporter.sendMail( alternatives).gain res.json( information: "Email delivered" ). ).app.listen( 3001 ).Records.Get the complete information [listed here] ().Parts.You can find the elements, listed here:.Integrations.Emails built along with vue-email could be converted into HTML or.plain text, and delivered making use of any type of e-mail company. You can view.examples right here:.