Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually motivated by react-email, it allows us produce templates using the vue platform, with components that aid our team construct themes quickly as well as quick.To start making use of vue-email in any sort of vue project, you only require to set up the package:.Along with NPM:.$ npm install vue-email.With Yarn:.$ yarn include vue-email.With PNPM:.$ pnpm install vue-email.Producing e-mail template.Create a brand new e-mail theme in anywhere you wish to possess your templates, for this case, our company can produce a design template file, with a template called welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue element library for structure reactive emails.Scenery on GitHub.Delighted coding!David Arenas.
Providing the layouts.We can use the render feature, it acquires two params, the first one is the template to render, as well as the 2nd the params to be used for the template, and after that pass the outcome theme in the body of ask for.Passing the template in the body, offer our company the odds of providing utilizing any server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail along with nodemailer.Placed email.
Deliver e-mail.In this example i making use of nuxt v3 due to the fact that it permits our team to establish api inside very own venture, and specify numerous api courses.Below we only remove the theme of the request body, and send the email passing the layout in the sendMail functionality of the nodemailer bundle.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const body = await readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there globe',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are certainly not utilizing the web server in nuxt, you may conveniently apply on any kind of platform for instance utilizing reveal:.bring express from 'reveal'.bring in nodemailer coming from 'nodemailer'.const application = show().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there globe',.html: theme,..await transporter.sendMail( choices).gain res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Documents.Acquire the complete records [listed here] ().Parts.You may observe the elements, listed here:.Integrations.Emails developed along with vue-email could be converted into HTML or even.plain text, and also sent utilizing any sort of e-mail provider. You can find.instances listed below:.

Articles You Can Be Interested In