Sleep

Vue- Email - Vue.js Supplied

.Vue-email is motivated by react-email, it permits our company make design templates using the vue structure, along with components that assist our company construct design templates easily as well as fast.To begin making use of vue-email in any type of vue project, you simply require to set up the deal:.Along with NPM:.$ npm mount vue-email.With Yarn:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm put in vue-email.Making email design template.Create a new email layout in anywhere you would like to have your design templates, for this situation, our company can generate a template folder, with a design template phoned welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component collection for building reactive e-mails.Scenery on GitHub.Delighted coding!David Arenas.
Providing the themes.Our company can easily make use of the provide functionality, it obtains two params, the initial one is the layout to provide, and the 2nd the params to become utilized for the theme, and then pass the outcome template in the physical body of demand.Passing the template in the physical body, provide our team the odds of providing making use of any type of server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver e-mail with nodemailer.Placed e-mail.
Send out e-mail.In this instance i utilizing nuxt v3 considering that it enables us to prepare api inside own task, and determine multiple api options.Right here our team only draw out the design template of the request physical body, and also deliver the e-mail passing the template in the sendMail functionality of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const physical body = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello planet',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are not utilizing the hosting server in nuxt, you can quickly carry out on any structure for example utilizing show:.bring reveal from 'reveal'.import nodemailer from 'nodemailer'.const app = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there globe',.html: theme,..wait for transporter.sendMail( choices).profit res.json( message: "Email sent" ). ).app.listen( 3001 ).Documents.Get the total documentation [below] ().Components.You may see the parts, listed below:.Assimilations.E-mails built with vue-email can be converted into HTML or.plain text, as well as sent using any type of email specialist. You can see.instances here:.