.Vue-email is encouraged through react-email, it enables our company make templates using the vue structure, along with elements that assist us create design templates simply as well as quick.To begin using vue-email in any type of vue task, you merely need to put in the bundle:.Along with NPM:.$ npm set up vue-email.With Anecdote:.$ anecdote incorporate vue-email.With PNPM:.$ pnpm mount vue-email.Developing e-mail layout.Create a brand-new e-mail theme in any place you wish to possess your layouts, for this instance, our company can make a template folder, along with a template called welcome.vue.src/templates/welcome. vue.
title, invited to vue-email.A Vue part library for structure responsive e-mails.Perspective on GitHub.Satisfied coding!David Arenas.
Making the design templates.Our experts may utilize the leave feature, it acquires pair of params, the initial one is actually the template to provide, and also the 2nd the params to be made use of for the template, and then pass the outcome layout in the body of ask for.Passing the design template in the physical body, provide our company the possibility of making using any hosting server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Mailed email.
Deliver e-mail.In this particular example i making use of nuxt v3 because it permits our company to set api inside own venture, as well as determine multiple api options.Listed below we just extract the theme of the ask for physical body, and also send the email passing the template in the sendMail feature of the nodemailer deal.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (activity) => const body = wait for readBody( event).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there globe',.html: body.template,..wait for transporter.sendMail( options). ).If you are certainly not making use of the hosting server in nuxt, you can effortlessly apply on any type of structure for instance using convey:.import show coming from 'convey'.bring in nodemailer coming from 'nodemailer'.const application = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) => const template = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.secure: false,.auth: individual: testAccount.user,.successfully pass: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings globe',.html: theme,..wait for transporter.sendMail( choices).return res.json( notification: "Email sent" ). ).app.listen( 3001 ).Records.Receive the full records [right here] ().Parts.You can easily view the parts, listed below:.Combinations.E-mails constructed with vue-email may be converted into HTML or.clear text, and also delivered using any e-mail company. You can see.instances below:.