Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced by react-email, it enables our team produce layouts utilizing the vue platform, with parts that help us create design templates easily as well as quick.To begin making use of vue-email in any type of vue venture, you simply require to install the plan:.Along with NPM:.$ npm put in vue-email.With Anecdote:.$ yarn include vue-email.With PNPM:.$ pnpm set up vue-email.Creating email layout.Make a new email layout in wherever you intend to have your themes, for this situation, we may develop a layout folder, with a design template contacted welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue element public library for building reactive emails.Viewpoint on GitHub.Happy coding!David Arenas.
Leaving the layouts.Our company can easily make use of the provide function, it acquires 2 params, the first one is the theme to render, and the 2nd the params to be utilized for the layout, and afterwards pass the end result layout in the body of demand.Passing the layout in the physical body, offer us the chance of leaving using any hosting server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Send email along with nodemailer.Mailed email.
Deliver email.In this particular example i using nuxt v3 given that it enables our company to set api inside very own project, as well as specify a number of api options.Listed below our experts just remove the theme of the ask for body, and also deliver the e-mail passing the layout in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const physical body = await readBody( celebration).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.safe and secure: false,.auth: customer: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hey there planet',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are actually certainly not utilizing the web server in nuxt, you can conveniently implement on any sort of framework for example utilizing share:.bring share from 'express'.import nodemailer coming from 'nodemailer'.const application = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe and secure: false,.auth: user: testAccount.user,.pass: testAccount.pass,.,. ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings world',.html: theme,..wait for transporter.sendMail( possibilities).yield res.json( information: "Email delivered" ). ).app.listen( 3001 ).Records.Acquire the total information [here] ().Parts.You can easily see the parts, listed here:.Integrations.Emails created with vue-email could be converted into HTML or.clear text, and sent using any sort of email specialist. You can easily view.examples below:.