Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced by react-email, it permits us produce layouts utilizing the vue platform, with components that aid our team develop design templates conveniently and also quickly.To begin making use of vue-email in any sort of vue task, you only need to set up the package:.With NPM:.$ npm put up vue-email.Along with Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm install vue-email.Creating email layout.Develop a new email design template in wherever you want to have your layouts, for this case, our company may generate a theme directory, with a design template gotten in touch with welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component public library for building reactive emails.Viewpoint on GitHub.Delighted coding!David Arenas.
Leaving the templates.Our company may use the leave feature, it gets two params, the first one is actually the template to provide, and the 2nd the params to be made use of for the layout, and afterwards pass the end result layout in the physical body of demand.Passing the template in the physical body, give us the odds of leaving using any sort of hosting server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send e-mail along with nodemailer.Delivered e-mail.
Deliver e-mail.In this example i making use of nuxt v3 due to the fact that it enables us to establish api inside very own job, and describe various api options.Below our experts simply draw out the theme of the ask for body system, as well as send the e-mail passing the layout in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const body system = await readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there globe',.html: body.template,..await transporter.sendMail( choices). ).If you are not making use of the server in nuxt, you can effortlessly implement on any type of framework for instance utilizing show:.bring reveal from 'convey'.import nodemailer from 'nodemailer'.const application = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there globe',.html: design template,..await transporter.sendMail( possibilities).yield res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Documentation.Receive the full paperwork [listed here] ().Components.You may see the elements, listed here:.Assimilations.Emails constructed with vue-email could be converted into HTML or even.plain text, as well as sent making use of any email service provider. You may view.instances listed below:.