Sleep

Vue- Email - Vue.js Nourished

.Vue-email is motivated by react-email, it enables our company create templates making use of the vue platform, along with elements that aid our company build design templates simply as well as fast.To begin using vue-email in any kind of vue job, you just need to have to mount the plan:.Along with NPM:.$ npm install vue-email.Along with Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm mount vue-email.Developing email layout.Create a brand new email theme in wherever you wish to have your design templates, for this instance, our experts may create a layout directory, with a design template contacted welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue component public library for property responsive emails.Scenery on GitHub.Delighted coding!David Arenas.
Providing the design templates.Our team may use the make functionality, it obtains pair of params, the 1st one is the template to make, and also the 2nd the params to be utilized for the design template, and afterwards pass the end result layout in the physical body of demand.Passing the design template in the body, provide our company the odds of leaving using any kind of hosting server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail along with nodemailer.Mailed email.
Send email.In this particular example i making use of nuxt v3 considering that it permits us to set api inside very own project, and also specify various api options.Below our team only remove the template of the demand body, as well as send out the e-mail passing the template in the sendMail functionality of the nodemailer package.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const physical body = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( host: process.env.HOST ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings planet',.html: body.template,..wait for transporter.sendMail( choices). ).If you are actually not utilizing the server in nuxt, you may conveniently execute on any structure for instance utilizing show:.import show from 'reveal'.bring in nodemailer from 'nodemailer'.const app = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( host: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi globe',.html: template,..await transporter.sendMail( alternatives).gain res.json( information: "Email delivered" ). ).app.listen( 3001 ).Documents.Get the complete information [below] ().Components.You can easily observe the parts, listed here:.Assimilations.Emails developed with vue-email can be exchanged HTML or.plain text, and also delivered making use of any type of email service provider. You may view.examples below:.