Sleep

Vue- Email - Vue.js Feed

.Vue-email is motivated through react-email, it enables us create themes using the vue structure, along with parts that assist us construct themes conveniently and swiftly.To begin making use of vue-email in any type of vue job, you just need to have to mount the package deal:.With NPM:.$ npm install vue-email.Along with Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm put in vue-email.Making email design template.Develop a new e-mail template in everywhere you want to possess your layouts, for this instance, our team can easily create a theme folder, with a theme gotten in touch with welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component collection for structure responsive e-mails.Sight on GitHub.Delighted coding!David Arenas.
Making the layouts.Our experts may use the provide functionality, it acquires two params, the first one is actually the template to render, and also the 2nd the params to become utilized for the template, and after that pass the end result theme in the body system of request.Passing the template in the body system, provide our team the odds of providing making use of any sort of hosting server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail with nodemailer.Emailed e-mail.
Send out e-mail.Within this instance i making use of nuxt v3 due to the fact that it enables us to prepare api inside own task, and also describe multiple api paths.Below our experts merely extract the template of the request physical body, and also deliver the email passing the template in the sendMail functionality of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer 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( 'smtp.ethereal.email',.slot: 587,.protected: misleading,.auth: user: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there globe',.html: body.template,..await transporter.sendMail( options). ).If you are actually not utilizing the web server in nuxt, you can quickly carry out on any framework for instance using convey:.import express coming from 'show'.bring in nodemailer coming 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 = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe and secure: inaccurate,.auth: user: testAccount.user,.elapsed: testAccount.pass,.,. ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi there globe',.html: template,..wait for transporter.sendMail( alternatives).yield res.json( message: "Email sent" ). ).app.listen( 3001 ).Documents.Acquire the complete documentation [listed below] ().Parts.You may view the components, listed here:.Assimilations.E-mails created with vue-email may be exchanged HTML or.clear text, and also sent using any type of e-mail company. You can easily find.instances below:.

Articles You Can Be Interested In