Sleep

Vue- Email - Vue.js Supplied

.Vue-email is influenced by react-email, it allows our team generate design templates utilizing the vue structure, with parts that aid our team build themes conveniently and quickly.To begin making use of vue-email in any kind of vue venture, you only require to put up the deal:.With NPM:.$ npm mount vue-email.With Yarn:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm put up vue-email.Creating e-mail template.Develop a brand-new email design template in any place you desire to possess your templates, for this case, our team may develop a design template directory, along with a theme phoned welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component public library for building responsive emails.Scenery on GitHub.Happy coding!David Arenas.
Leaving the templates.Our experts may use the provide feature, it receives 2 params, the 1st one is the template to leave, and also the 2nd the params to be utilized for the template, and then pass the outcome design template in the body system of request.Passing the template in the body system, give us the possibility of leaving using any sort of hosting server, share, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email with nodemailer.Sent email.
Send e-mail.In this particular instance i utilizing nuxt v3 because it allows our team to specify api inside own job, as well as determine a number of api options.Below our team merely draw out the layout of the ask for body, and also deliver the email passing the theme in the sendMail function of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const body = wait for readBody( celebration).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there planet',.html: body.template,..await transporter.sendMail( options). ).If you are not utilizing the hosting server in nuxt, you may conveniently carry out on any kind of structure for instance utilizing show:.import show from 'reveal'.import nodemailer coming from 'nodemailer'.const app = express().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( multitude: process.env.HOST ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings world',.html: theme,..wait for transporter.sendMail( options).yield res.json( notification: "Email sent" ). ).app.listen( 3001 ).Information.Get the full documents [listed below] ().Components.You may see the components, listed here:.Assimilations.E-mails built with vue-email may be exchanged HTML or even.clear text, and also sent out using any kind of e-mail specialist. You may see.instances listed below:.