.Vue-email is actually motivated by react-email, it permits us create design templates making use of the vue platform, with parts that aid us develop design templates effortlessly and quick.To begin using vue-email in any vue venture, you merely need to have to mount the deal:.With NPM:.$ npm put up vue-email.With Anecdote:.$ anecdote include vue-email.Along with PNPM:.$ pnpm set up vue-email.Developing email theme.Develop a brand new e-mail design template in wherever you intend to have your themes, for this case, our experts can easily develop a template file, along with a design template gotten in touch with welcome.vue.src/templates/welcome. vue.
label, appreciated to vue-email.A Vue element library for property responsive e-mails.View on GitHub.Pleased coding!David Arenas.
Leaving the templates.Our company may utilize the provide functionality, it acquires 2 params, the very first one is actually the theme to provide, and also the second the params to be used for the template, and after that pass the result theme in the body system of ask for.Passing the template in the body system, provide our team the opportunity of making using any type of hosting server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail with nodemailer.Posted e-mail.
Deliver email.In this example i using nuxt v3 due to the fact that it permits our team to establish api inside personal venture, as well as describe various api courses.Below we just draw out the layout of the demand physical body, and send the e-mail passing the theme in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (occasion) => const body = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.protected: incorrect,.auth: customer: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hey there globe',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually not utilizing the hosting server in nuxt, you can simply implement on any kind of platform for example making use of reveal:.import convey from 'express'.import nodemailer coming from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) => const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( host: process.env.HOST ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello world',.html: template,..wait for transporter.sendMail( possibilities).yield res.json( notification: "Email sent" ). ).app.listen( 3001 ).Documentation.Obtain the total records [right here] ().Elements.You can observe the parts, listed here:.Integrations.E-mails created along with vue-email could be exchanged HTML or even.plain text, and sent making use of any type of e-mail company. You can find.instances here:.