Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually inspired through react-email, it enables our company generate layouts utilizing the vue platform, along with elements that assist our company build design templates quickly and also swiftly.To begin utilizing vue-email in any sort of vue project, you merely need to have to set up the plan:.With NPM:.$ npm put up vue-email.With Anecdote:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm set up vue-email.Developing e-mail layout.Make a brand-new e-mail template in everywhere you desire to have your templates, for this situation, our team can create a template folder, with a layout gotten in touch with welcome.vue.src/templates/welcome. vue.

title, welcome to vue-email.A Vue element collection for property responsive emails.Scenery on GitHub.Satisfied coding!David Arenas.
Providing the layouts.We can easily utilize the make feature, it receives pair of params, the 1st one is actually the template to provide, and the second the params to become made use of for the layout, and then pass the outcome template in the physical body of request.Passing the layout in the body system, give our company the chance of rendering making use of any type of server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email along with nodemailer.Mailed e-mail.
Send email.Within this instance i making use of nuxt v3 given that it enables us to specify api inside own task, and also determine a number of api options.Below our experts merely extract the layout of the ask for body, and deliver the e-mail passing the design template in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const physical body = wait for readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello world',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually not using the server in nuxt, you may effortlessly apply on any kind of platform for example utilizing show:.import convey from 'show'.import nodemailer coming from 'nodemailer'.const application = show().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hey there planet',.html: theme,..await transporter.sendMail( options).gain res.json( information: "Email sent out" ). ).app.listen( 3001 ).Information.Obtain the full documents [here] ().Parts.You can observe the components, listed below:.Assimilations.Emails built with vue-email may be exchanged HTML or even.plain text, and also sent out using any kind of e-mail specialist. You may view.instances here:.