Sleep

Vue- Email - Vue.js Supplied

.Vue-email is inspired through react-email, it allows our company develop templates utilizing the vue framework, with components that help us create templates quickly as well as quickly.To begin using vue-email in any kind of vue task, you just need to have to put up the deal:.With NPM:.$ npm set up vue-email.Along with Yarn:.$ yarn incorporate vue-email.With PNPM:.$ pnpm set up vue-email.Producing email layout.Create a brand new e-mail design template in everywhere you wish to possess your templates, for this case, our experts can make a layout directory, along with a layout gotten in touch with welcome.vue.src/templates/welcome. vue.

label, invited to vue-email.A Vue part public library for property receptive e-mails.Perspective on GitHub.Pleased coding!David Arenas.
Providing the templates.We can easily utilize the make function, it receives two params, the initial one is actually the design template to make, and the second the params to be utilized for the layout, and afterwards pass the outcome theme in the body system of request.Passing the theme in the body, provide our team the possibility of leaving using any hosting server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Send email along with nodemailer.Routed e-mail.
Deliver email.Within this example i using nuxt v3 given that it allows our company to set api inside very own project, and also specify a number of api options.Right here our company merely extract the layout of the demand body system, and also deliver the e-mail passing the template in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (event) =&gt const physical body = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there planet',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are not utilizing the server in nuxt, you may easily implement on any type of framework for instance using share:.bring share coming from 'show'.bring in nodemailer from 'nodemailer'.const application = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there planet',.html: template,..wait for transporter.sendMail( choices).gain res.json( notification: "Email sent out" ). ).app.listen( 3001 ).Information.Obtain the full records [listed below] ().Components.You can easily view the elements, listed below:.Assimilations.E-mails created along with vue-email could be exchanged HTML or.plain text, and delivered making use of any sort of e-mail provider. You may find.instances listed here:.