Sleep

Vue- Email - Vue.js Nourished

.Vue-email is encouraged by react-email, it permits our company create templates utilizing the vue platform, along with components that help our company build design templates effortlessly and swiftly.To begin utilizing vue-email in any type of vue job, you simply need to have to install the plan:.With NPM:.$ npm put in vue-email.With Yarn:.$ anecdote add vue-email.With PNPM:.$ pnpm set up vue-email.Making email layout.Create a new email design template in any place you wish to possess your layouts, for this situation, our experts may generate a template directory, along with a theme called welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue component library for structure reactive emails.View on GitHub.Pleased coding!David Arenas.
Making the templates.Our experts can use the render functionality, it gets pair of params, the very first one is the layout to provide, and also the second the params to become utilized for the design template, and then pass the outcome theme in the body system of demand.Passing the design template in the body, offer us the odds of providing using any web server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email along with nodemailer.Shipped email.
Send out e-mail.Within this example i using nuxt v3 considering that it permits us to set api inside very own venture, and also define a number of api paths.Right here our team just remove the layout of the ask for physical body, and also send out the email passing the template in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const body = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there planet',.html: body.template,..await transporter.sendMail( choices). ).If you are certainly not making use of the hosting server in nuxt, you may effortlessly apply on any type of framework as an example making use of express:.bring express from 'convey'.bring in nodemailer from 'nodemailer'.const application = show().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.protected: misleading,.auth: individual: testAccount.user,.elapsed: testAccount.pass,.,. ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there planet',.html: design template,..wait for transporter.sendMail( possibilities).return res.json( information: "Email sent out" ). ).app.listen( 3001 ).Paperwork.Get the total records [here] ().Parts.You can view the elements, listed below:.Integrations.Emails developed with vue-email may be exchanged HTML or even.plain text, and also sent utilizing any email specialist. You can easily see.instances listed here:.