Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced through react-email, it allows our company produce themes making use of the vue structure, with elements that help our company construct layouts easily and also quick.To start using vue-email in any sort of vue venture, you only need to put in the deal:.Along with NPM:.$ npm set up vue-email.With Yarn:.$ yarn add vue-email.With PNPM:.$ pnpm set up vue-email.Generating email template.Develop a brand new email layout in anywhere you intend to have your layouts, for this scenario, our team can easily create a design template file, along with a design template contacted welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue component library for structure reactive emails.View on GitHub.Pleased coding!David Arenas.
Leaving the layouts.Our company can easily use the provide feature, it acquires pair of params, the first one is the template to make, and the second the params to be utilized for the design template, and afterwards pass the end result layout in the body of demand.Passing the theme in the physical body, offer us the opportunity of providing making use of any sort of hosting server, share, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email along with nodemailer.Delivered e-mail.
Deliver email.In this instance i using nuxt v3 because it permits our team to set api inside very own task, as well as specify various api options.Right here our team just extract the template of the request body, as well as deliver the e-mail passing the layout in the sendMail functionality of the nodemailer bundle.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const body = await readBody( celebration).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi globe',.html: body.template,..await transporter.sendMail( options). ).If you are actually certainly not using the hosting server in nuxt, you can quickly apply on any platform for example making use of reveal:.bring show from 'express'.import nodemailer coming from 'nodemailer'.const application = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings world',.html: template,..await transporter.sendMail( possibilities).return res.json( notification: "Email sent" ). ).app.listen( 3001 ).Documentation.Receive the full information [here] ().Components.You can find the elements, listed below:.Combinations.Emails developed along with vue-email can be exchanged HTML or even.plain text, and sent out making use of any email provider. You can view.examples below:.

Articles You Can Be Interested In