.Vue-email is actually influenced by react-email, it permits our team produce themes making use of the vue platform, with components that aid our company build themes easily as well as swiftly.To start utilizing vue-email in any sort of vue task, you merely need to have to put up the plan:.With NPM:.$ npm set up vue-email.With Anecdote:.$ yarn include vue-email.Along with PNPM:.$ pnpm put in vue-email.Developing email template.Produce a new e-mail template in wherever you would like to have your templates, for this case, we can easily create a theme folder, with a layout contacted welcome.vue.src/templates/welcome. vue.
label, welcome to vue-email.A Vue element public library for property reactive e-mails.View on GitHub.Happy coding!David Arenas.
Leaving the themes.Our team may make use of the make function, it acquires pair of params, the very first one is the template to provide, as well as the second the params to be utilized for the template, and then pass the end result theme in the body of ask for.Passing the design template in the body, offer us the possibility of leaving using any web server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email along with nodemailer.Posted e-mail.
Deliver e-mail.Within this example i utilizing nuxt v3 due to the fact that it allows our company to set api inside personal job, and specify numerous api options.Right here our experts simply draw out the theme of the ask for physical body, as well as deliver the email passing the layout in the sendMail feature of the nodemailer package.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (activity) => const body = wait for readBody( event).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there planet',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually not utilizing the server in nuxt, you may simply apply on any type of structure for instance making use of show:.bring express from 'share'.import nodemailer from 'nodemailer'.const app = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) => const template = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello world',.html: layout,..await transporter.sendMail( alternatives).yield res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Information.Get the total documents [below] ().Elements.You may view the elements, listed below:.Integrations.E-mails developed along with vue-email could be exchanged HTML or.clear text, as well as sent making use of any kind of e-mail service provider. You may see.examples below:.