Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually influenced through react-email, it permits our team develop themes making use of the vue structure, along with elements that aid our company develop templates easily and also quick.To start making use of vue-email in any type of vue job, you only need to put up the plan:.Along with NPM:.$ npm put up vue-email.With Yarn:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm put up vue-email.Making e-mail theme.Make a brand new e-mail theme in anywhere you would like to have your layouts, for this case, our company can easily create a layout file, along with a design template phoned welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue component collection for property reactive emails.Perspective on GitHub.Pleased coding!David Arenas.
Providing the design templates.Our experts may make use of the make function, it receives pair of params, the very first one is actually the theme to provide, and the second the params to become utilized for the design template, and then pass the outcome layout in the body of request.Passing the template in the physical body, give our team the chance of leaving utilizing any kind of hosting server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver e-mail with nodemailer.Sent e-mail.
Deliver e-mail.Within this instance i making use of nuxt v3 considering that it permits us to prepare api inside very own project, and define various api courses.Right here we only extract the theme of the request physical body, and also deliver the email passing the theme in the sendMail feature of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body = await readBody( event).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello planet',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually not utilizing the server in nuxt, you can simply carry out on any type of structure for example making use of convey:.import express from 'reveal'.bring in nodemailer coming from 'nodemailer'.const application = show().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there globe',.html: design template,..wait for transporter.sendMail( alternatives).yield res.json( information: "Email delivered" ). ).app.listen( 3001 ).Information.Acquire the complete documents [listed below] ().Elements.You can easily see the parts, listed here:.Integrations.Emails created along with vue-email may be exchanged HTML or.plain text, and delivered making use of any e-mail company. You may view.examples right here:.