Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually encouraged through react-email, it allows us make templates utilizing the vue framework, with parts that aid our company develop themes easily and fast.To begin using vue-email in any vue venture, you only require to mount the bundle:.With NPM:.$ npm install vue-email.With Anecdote:.$ yarn add vue-email.With PNPM:.$ pnpm put up vue-email.Producing e-mail template.Generate a brand new email design template in wherever you desire to possess your templates, for this situation, we can make a design template directory, along with a design template contacted welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue part collection for structure reactive emails.Viewpoint on GitHub.Satisfied coding!David Arenas.
Rendering the design templates.Our team can easily utilize the leave feature, it obtains two params, the first one is the design template to provide, and also the second the params to become made use of for the layout, and afterwards pass the result theme in the body of request.Passing the theme in the body system, offer our team the odds of making using any sort of hosting server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out e-mail with nodemailer.Placed email.
Send e-mail.Within this example i utilizing nuxt v3 considering that it enables our company to prepare api inside very own project, and describe various api courses.Here our experts just draw out the theme of the demand body, and send the e-mail passing the layout in the sendMail function of the nodemailer package.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body = await readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe: misleading,.auth: customer: testAccount.user,.successfully pass: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there planet',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually not utilizing the web server in nuxt, you can conveniently execute on any framework for instance using reveal:.import reveal from 'convey'.bring in nodemailer coming from 'nodemailer'.const app = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there globe',.html: template,..await transporter.sendMail( options).gain res.json( notification: "Email sent out" ). ).app.listen( 3001 ).Documentation.Acquire the complete information [here] ().Components.You can find the parts, listed here:.Assimilations.E-mails developed with vue-email could be exchanged HTML or even.clear text, as well as sent out making use of any type of e-mail specialist. You can easily find.instances right here:.