Sleep

Vue- Email - Vue.js Supplied

.Vue-email is encouraged through react-email, it enables our company produce design templates using the vue platform, with elements that help our company construct design templates conveniently and also fast.To begin making use of vue-email in any sort of vue job, you simply require to put up the plan:.With NPM:.$ npm set up vue-email.Along with Anecdote:.$ yarn include vue-email.With PNPM:.$ pnpm put in vue-email.Developing email layout.Create a brand new email design template in anywhere you want to possess your layouts, for this instance, our company can easily produce a design template directory, along with a layout called welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue component library for structure reactive e-mails.Viewpoint on GitHub.Satisfied coding!David Arenas.
Leaving the themes.Our company can easily use the leave feature, it gets 2 params, the 1st one is the template to make, and the second the params to be used for the theme, and afterwards pass the outcome design template in the physical body of ask for.Passing the design template in the body, give our team the chance of making utilizing any kind of web server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send e-mail along with nodemailer.Shipped email.
Send e-mail.Within this instance i making use of nuxt v3 due to the fact that it permits our company to establish api inside very own task, and define a number of api options.Right here our experts merely extract the template of the ask for body, and deliver the e-mail passing the template in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const physical body = wait for readBody( event).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( bunch: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi world',.html: body.template,..await transporter.sendMail( alternatives). ).If you are certainly not using the web server in nuxt, you may simply apply on any type of structure for instance making use of express:.bring share coming from 'express'.bring in nodemailer from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.protected: inaccurate,.auth: consumer: testAccount.user,.pass: testAccount.pass,.,. ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi world',.html: design template,..await transporter.sendMail( possibilities).return res.json( message: "Email delivered" ). ).app.listen( 3001 ).Information.Receive the full paperwork [below] ().Parts.You can see the components, listed here:.Assimilations.E-mails constructed along with vue-email may be converted into HTML or.clear text, and delivered making use of any sort of e-mail company. You can easily observe.instances right here:.