Sleep

Vue- Email - Vue.js Feed

.Vue-email is influenced by react-email, it enables our company produce templates utilizing the vue structure, with components that assist our company develop themes simply as well as quickly.To start using vue-email in any type of vue task, you simply need to set up the package deal:.Along with NPM:.$ npm put up vue-email.With Yarn:.$ yarn include vue-email.Along with PNPM:.$ pnpm install vue-email.Developing email design template.Create a brand new email theme in any place you want to possess your layouts, for this instance, our team can make a template directory, along with a layout contacted welcome.vue.src/templates/welcome. vue.

label, welcome to vue-email.A Vue part public library for property reactive emails.Viewpoint on GitHub.Satisfied coding!David Arenas.
Leaving the themes.Our team can easily utilize the provide functionality, it gets two params, the initial one is actually the design template to provide, as well as the second the params to be utilized for the template, and then pass the result layout in the physical body of request.Passing the design template in the physical body, give our company the possibility of rendering using any type of server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver e-mail with nodemailer.Dispatched email.
Send out email.In this instance i making use of nuxt v3 considering that it permits our company to prepare api inside own job, and describe a number of api courses.Listed below our company just remove the theme of the request body system, and send the e-mail passing the layout in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const body system = await readBody( activity).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hello there world',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually certainly not making use of the hosting server in nuxt, you can conveniently apply on any platform as an example using express:.import express coming from 'reveal'.import nodemailer coming from 'nodemailer'.const application = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings planet',.html: template,..await transporter.sendMail( alternatives).return res.json( message: "Email delivered" ). ).app.listen( 3001 ).Documentation.Receive the full records [listed below] ().Components.You can easily view the components, listed here:.Integrations.E-mails created with vue-email could be converted into HTML or even.plain text, and also sent making use of any sort of email service provider. You can easily find.examples right here:.

Articles You Can Be Interested In