Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually inspired by react-email, it enables our company generate layouts making use of the vue framework, with components that assist our company build design templates quickly and quick.To start using vue-email in any sort of vue project, you simply require to set up the plan:.Along with NPM:.$ npm put in vue-email.Along with Yarn:.$ yarn include vue-email.With PNPM:.$ pnpm mount vue-email.Generating email layout.Develop a new email template in wherever you intend to have your templates, for this instance, our company may generate a layout directory, with a design template phoned welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue element collection for building responsive emails.Viewpoint on GitHub.Satisfied coding!David Arenas.
Providing the design templates.Our team can use the leave feature, it receives 2 params, the 1st one is actually the theme to make, and the 2nd the params to be used for the design template, and after that pass the outcome theme in the body system of ask for.Passing the layout in the body, offer us the opportunity of leaving using any kind of hosting server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out e-mail with nodemailer.Delivered email.
Send out email.Within this instance i using nuxt v3 because it permits our team to specify api inside very own project, as well as specify several api options.Listed below our company simply draw out the layout of the ask for body system, as well as deliver the email passing the template in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const physical body = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( multitude: process.env.HOST ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello world',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are not utilizing the hosting server in nuxt, you can simply implement on any framework as an example using convey:.import reveal from 'reveal'.import nodemailer from 'nodemailer'.const application = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there world',.html: theme,..await transporter.sendMail( alternatives).profit res.json( information: "Email sent out" ). ).app.listen( 3001 ).Records.Acquire the total documentation [listed below] ().Elements.You may view the components, listed here:.Assimilations.Emails developed with vue-email may be exchanged HTML or.clear text, and delivered using any type of e-mail provider. You may find.examples below:.

Articles You Can Be Interested In