Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually encouraged through react-email, it enables us make templates using the vue framework, with parts that aid us develop design templates simply and also swiftly.To begin using vue-email in any kind of vue job, you only require to mount the package deal:.With NPM:.$ npm install vue-email.Along with Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm install vue-email.Making email layout.Create a brand new email theme in wherever you wish to possess your layouts, for this situation, our company can easily generate a template directory, along with a template phoned welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue element library for structure responsive emails.Scenery on GitHub.Pleased coding!David Arenas.
Rendering the design templates.Our experts can make use of the make functionality, it obtains two params, the 1st one is the design template to make, and also the 2nd the params to be made use of for the theme, and afterwards pass the end result template in the body of demand.Passing the design template in the physical body, provide our team the possibility of making using any type of hosting server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email along with nodemailer.Sent e-mail.
Deliver e-mail.In this instance i making use of nuxt v3 due to the fact that it permits our company to specify api inside very own task, as well as specify multiple api paths.Listed below our company simply extract the template of the ask for physical body, and deliver the e-mail passing the template in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (occasion) =&gt const body system = wait for readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'greetings globe',.html: body.template,..wait for transporter.sendMail( choices). ).If you are actually not utilizing the web server in nuxt, you may effortlessly execute on any type of platform for instance using convey:.import express coming from 'express'.bring in nodemailer coming from 'nodemailer'.const app = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there planet',.html: design template,..wait for transporter.sendMail( alternatives).profit res.json( information: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Get the total records [here] ().Parts.You can find the parts, listed below:.Integrations.E-mails built with vue-email can be converted into HTML or.clear text, and sent using any sort of email service provider. You can view.examples here:.