Sleep

Vue- Email - Vue.js Supplied

.Vue-email is encouraged by react-email, it allows our team produce templates utilizing the vue platform, along with elements that help us build design templates quickly and also quick.To start making use of vue-email in any vue project, you only need to have to mount the bundle:.With NPM:.$ npm set up vue-email.With Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm put in vue-email.Generating e-mail template.Produce a new email template in anywhere you would like to have your design templates, for this scenario, our team can easily generate a template directory, along with a theme called welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue element library for building responsive e-mails.Scenery on GitHub.Delighted coding!David Arenas.
Providing the themes.Our team can make use of the leave function, it acquires 2 params, the first one is actually the design template to provide, and the 2nd the params to be used for the design template, and after that pass the result template in the body of demand.Passing the layout in the body, provide our company the chance of providing utilizing any kind of server, express, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver email along with nodemailer.Mailed email.
Send out email.In this instance i utilizing nuxt v3 considering that it enables us to set api inside very own task, and also specify a number of api paths.Right here our team only extract the theme of the request physical body, and also deliver the e-mail passing the template in the sendMail function of the nodemailer deal.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body system = await readBody( celebration).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello world',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are certainly not using the web server in nuxt, you may quickly implement on any sort of platform for example using share:.bring show from 'reveal'.bring in nodemailer from 'nodemailer'.const app = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe: false,.auth: individual: testAccount.user,.elapsed: testAccount.pass,.,. ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there world',.html: theme,..await transporter.sendMail( alternatives).yield res.json( information: "Email sent out" ). ).app.listen( 3001 ).Records.Obtain the complete documents [below] ().Elements.You can view the parts, listed below:.Combinations.E-mails developed along with vue-email may be exchanged HTML or.clear text, and delivered making use of any kind of e-mail service provider. You can see.examples right here:.