Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced through react-email, it allows us generate layouts utilizing the vue framework, along with elements that help our team develop design templates effortlessly and also fast.To start using vue-email in any kind of vue venture, you merely need to set up the package:.With NPM:.$ npm put up vue-email.Along with Yarn:.$ anecdote include vue-email.Along with PNPM:.$ pnpm mount vue-email.Generating email template.Make a brand-new email layout in everywhere you would like to possess your layouts, for this scenario, our experts can easily develop a theme file, with a layout gotten in touch with welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue element library for structure reactive e-mails.Scenery on GitHub.Pleased coding!David Arenas.
Leaving the themes.Our experts can make use of the make function, it receives pair of params, the initial one is the template to make, and also the 2nd the params to be used for the template, and then pass the result template in the physical body of request.Passing the design template in the body, offer our company the possibility of leaving making use of any type of server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail along with nodemailer.Directed e-mail.
Deliver email.In this instance i utilizing nuxt v3 due to the fact that it enables our team to establish api inside very own venture, and specify various api routes.Here our experts just remove the theme of the demand body, as well as send the e-mail passing the layout in the sendMail functionality of the nodemailer deal.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const physical body = await readBody( event).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello there planet',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually not making use of the server in nuxt, you may effortlessly carry out on any kind of structure for example utilizing reveal:.import express from 'show'.import nodemailer from 'nodemailer'.const application = express().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( host: process.env.HOST ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi world',.html: template,..await transporter.sendMail( possibilities).return res.json( information: "Email sent" ). ).app.listen( 3001 ).Records.Receive the full records [listed here] ().Elements.You may see the parts, listed here:.Integrations.Emails built with vue-email can be exchanged HTML or even.plain text, and sent out using any kind of email provider. You can find.instances listed below:.