Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually encouraged by react-email, it permits our team generate templates using the vue platform, along with parts that help our company construct templates easily as well as fast.To start making use of vue-email in any vue task, you only need to have to put in the deal:.Along with NPM:.$ npm install vue-email.Along with Yarn:.$ anecdote add vue-email.Along with PNPM:.$ pnpm install vue-email.Creating email theme.Generate a new e-mail layout in no matter where you desire to have your design templates, for this instance, our experts may generate a template file, with a theme gotten in touch with welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue element library for property receptive e-mails.Scenery on GitHub.Pleased coding!David Arenas.
Making the layouts.Our team may utilize the render feature, it gets 2 params, the initial one is actually the theme to render, as well as the second the params to be made use of for the layout, and afterwards pass the result design template in the body of ask for.Passing the template in the physical body, offer us the possibility of rendering utilizing any type of hosting server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send email along with nodemailer.Mailed e-mail.
Send out email.Within this example i utilizing nuxt v3 given that it allows our team to set api inside own venture, and also define numerous api paths.Listed here our company only extract the template of the demand physical body, and also deliver the email passing the template in the sendMail feature of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const physical body = wait for readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'greetings planet',.html: body.template,..await transporter.sendMail( options). ).If you are not using the server in nuxt, you can conveniently implement on any framework for example using share:.import express from 'reveal'.bring in nodemailer from 'nodemailer'.const app = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'greetings world',.html: design template,..await transporter.sendMail( alternatives).profit res.json( message: "Email delivered" ). ).app.listen( 3001 ).Documentation.Get the full information [below] ().Elements.You can easily view the elements, listed here:.Combinations.Emails built along with vue-email may be converted into HTML or even.plain text, as well as sent utilizing any kind of email service provider. You may view.examples listed below:.