Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually motivated through react-email, it enables us develop templates using the vue structure, with components that help our company develop templates effortlessly as well as quickly.To begin making use of vue-email in any kind of vue task, you simply need to have to mount the plan:.Along with NPM:.$ npm mount vue-email.Along with Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm put in vue-email.Making email template.Generate a brand-new e-mail design template in anywhere you would like to possess your templates, for this scenario, our company may make a template directory, with a layout called welcome.vue.src/templates/welcome. vue.

title, welcome to vue-email.A Vue part collection for property receptive emails.Perspective on GitHub.Pleased coding!David Arenas.
Providing the layouts.We can easily make use of the provide functionality, it gets two params, the 1st one is actually the template to render, as well as the second the params to become utilized for the design template, and afterwards pass the outcome template in the physical body of demand.Passing the design template in the body, offer us the odds of making making use of any sort of web server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver e-mail along with nodemailer.Sent e-mail.
Deliver e-mail.Within this instance i making use of nuxt v3 since it permits our team to set api inside very own job, and determine multiple api courses.Listed below our team just draw out the template of the demand physical body, and also send out the email passing the theme in the sendMail functionality of the nodemailer bundle.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body = await readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.secure: false,.auth: user: testAccount.user,.elapsed: testAccount.pass,.,. ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings planet',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually not using the web server in nuxt, you may effortlessly carry out on any kind of framework for example using reveal:.bring express from 'share'.bring in nodemailer from 'nodemailer'.const app = show().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.secure: inaccurate,.auth: individual: testAccount.user,.successfully pass: testAccount.pass,.,. ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi planet',.html: design template,..wait for transporter.sendMail( choices).return res.json( information: "Email sent out" ). ).app.listen( 3001 ).Records.Acquire the complete documentation [listed here] ().Parts.You can view the elements, listed here:.Assimilations.Emails developed along with vue-email may be converted into HTML or even.clear text, as well as sent out utilizing any sort of e-mail specialist. You can see.instances listed here:.

Articles You Can Be Interested In