Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced through react-email, it allows us generate design templates using the vue structure, along with components that help our team create themes conveniently and also fast.To start using vue-email in any sort of vue venture, you merely need to put up the package:.Along with NPM:.$ npm put up vue-email.With Yarn:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm install vue-email.Making e-mail design template.Create a brand-new email theme in anywhere you desire to possess your templates, for this scenario, our company can produce a design template file, with a template contacted welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component collection for building reactive e-mails.Sight on GitHub.Delighted coding!David Arenas.
Leaving the design templates.Our team can use the leave functionality, it acquires 2 params, the very first one is the template to make, and also the 2nd the params to become made use of for the template, and after that pass the result design template in the body system of demand.Passing the template in the physical body, give our team the odds of providing making use of any kind of web server, express, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail along with nodemailer.Directed email.
Deliver email.In this instance i making use of nuxt v3 due to the fact that it permits us to specify api inside own job, and also specify various api courses.Listed below our team merely remove the template of the ask for body, and also deliver the e-mail passing the design template in the sendMail feature of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const body system = await readBody( event).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.target: 'greetings globe',.html: body.template,..await transporter.sendMail( options). ).If you are certainly not utilizing the hosting server in nuxt, you can conveniently implement on any framework as an example utilizing show:.import convey from 'express'.import nodemailer coming from 'nodemailer'.const app = show().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( 'smtp.ethereal.email',.port: 587,.safe and secure: untrue,.auth: consumer: testAccount.user,.successfully pass: testAccount.pass,.,. ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there world',.html: theme,..wait for transporter.sendMail( options).gain res.json( information: "Email sent out" ). ).app.listen( 3001 ).Documents.Acquire the total paperwork [below] ().Elements.You can see the components, listed here:.Integrations.E-mails created with vue-email can be exchanged HTML or.plain text, as well as sent making use of any sort of email specialist. You can view.examples listed here:.