Sleep

Vue- Email - Vue.js Supplied

.Vue-email is influenced by react-email, it enables our company create layouts making use of the vue platform, along with parts that assist our company construct templates effortlessly as well as quick.To start utilizing vue-email in any kind of vue project, you merely need to have to mount the package deal:.With NPM:.$ npm put in vue-email.With Anecdote:.$ yarn add vue-email.Along with PNPM:.$ pnpm put up vue-email.Making e-mail template.Create a brand-new email theme in no matter where you wish to have your layouts, for this instance, our company can make a layout folder, with a layout phoned welcome.vue.src/templates/welcome. vue.

label, welcome to vue-email.A Vue element library for structure reactive e-mails.Viewpoint on GitHub.Happy coding!David Arenas.
Leaving the design templates.Our experts can easily utilize the provide function, it gets two params, the initial one is actually the theme to leave, as well as the 2nd the params to become utilized for the theme, and afterwards pass the end result design template in the body of ask for.Passing the layout in the physical body, offer our team the odds of making using any type of web server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Send e-mail along with nodemailer.Dispatched e-mail.
Send email.In this instance i using nuxt v3 given that it permits our team to establish api inside own project, and also determine a number of api courses.Listed here our team just extract the theme of the demand physical body, and also deliver the e-mail passing the layout in the sendMail functionality of the nodemailer deal.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const body system = await readBody( event).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe and secure: misleading,.auth: user: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi globe',.html: body.template,..wait for transporter.sendMail( choices). ).If you are not utilizing the hosting server in nuxt, you can easily apply on any structure for example making use of show:.import convey from 'express'.bring in nodemailer from 'nodemailer'.const app = convey().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 carrier = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hello planet',.html: design template,..await transporter.sendMail( possibilities).gain res.json( information: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Acquire the complete records [listed below] ().Elements.You may observe the parts, listed here:.Integrations.E-mails built with vue-email could be exchanged HTML or.clear text, and delivered making use of any type of email service provider. You can easily view.examples here:.

Articles You Can Be Interested In