Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually motivated by react-email, it allows our company produce templates utilizing the vue structure, along with components that assist our company develop layouts conveniently and fast.To begin making use of vue-email in any vue project, you only need to have to put up the plan:.Along with NPM:.$ npm install vue-email.Along with Anecdote:.$ anecdote include vue-email.Along with PNPM:.$ pnpm mount vue-email.Making e-mail layout.Create a brand new email design template in no matter where you wish to possess your templates, for this scenario, we can make a design template file, along with a layout contacted welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue element library for property responsive emails.Scenery on GitHub.Delighted coding!David Arenas.
Making the templates.Our team can easily use the make functionality, it gets pair of params, the 1st one is the design template to render, as well as the second the params to be made use of for the template, and then pass the result template in the physical body of ask for.Passing the theme in the body, provide us the chance of providing making use of any type of hosting server, reveal, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email along with nodemailer.Delivered e-mail.
Send out email.Within this instance i using nuxt v3 due to the fact that it permits us to prepare api inside own task, and also describe a number of api paths.Right here we just draw out the template of the request body, as well as send out the e-mail passing the design template in the sendMail function of the nodemailer deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const body = await readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hey there planet',.html: body.template,..wait for transporter.sendMail( options). ).If you are not utilizing the hosting server in nuxt, you can quickly carry out on any sort of platform for instance using show:.bring show from 'convey'.import nodemailer from 'nodemailer'.const application = show().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',.slot: 587,.secure: misleading,.auth: individual: testAccount.user,.successfully pass: testAccount.pass,.,. ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there globe',.html: layout,..await transporter.sendMail( choices).return res.json( information: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Get the total paperwork [right here] ().Components.You may see the components, listed below:.Integrations.E-mails constructed along with vue-email may be converted into HTML or.clear text, and also delivered using any sort of e-mail service provider. You may find.examples listed below:.