Sleep

Vue- Email - Vue.js Supplied

.Vue-email is inspired by react-email, it enables our company make layouts using the vue framework, with components that aid our team build themes simply as well as quickly.To begin utilizing vue-email in any kind of vue task, you only need to put in the bundle:.Along with NPM:.$ npm set up vue-email.With Yarn:.$ anecdote add vue-email.With PNPM:.$ pnpm put in vue-email.Developing e-mail theme.Develop a new email theme in any place you want to possess your layouts, for this situation, our experts can produce a design template file, with a design template contacted welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue part public library for structure responsive e-mails.View on GitHub.Delighted coding!David Arenas.
Providing the themes.Our company can use the make feature, it acquires pair of params, the 1st one is the design template to leave, and the 2nd the params to be used for the design template, and then pass the end result layout in the body of ask for.Passing the design template in the physical body, offer our company the opportunity of providing making use of any sort of server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Send e-mail along with nodemailer.Posted email.
Deliver email.In this instance i using nuxt v3 considering that it enables our team to set api inside personal job, and describe various api routes.Below we simply extract the layout of the request body, as well as send the e-mail passing the layout in the sendMail functionality of the nodemailer package.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const body = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there planet',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are actually not utilizing the hosting server in nuxt, you may quickly carry out on any sort of platform as an example utilizing reveal:.bring reveal 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 layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( multitude: process.env.HOST ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello globe',.html: design template,..await transporter.sendMail( choices).yield res.json( message: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Obtain the full paperwork [below] ().Parts.You can find the elements, listed here:.Combinations.Emails developed along with vue-email may be exchanged HTML or.clear text, and also sent out using any kind of e-mail company. You may find.instances listed here:.

Articles You Can Be Interested In