Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually encouraged by react-email, it allows our team develop themes using the vue structure, along with elements that assist us develop design templates easily and also swiftly.To start utilizing vue-email in any type of vue job, you simply need to have to put in the plan:.Along with NPM:.$ npm install vue-email.With Anecdote:.$ anecdote incorporate vue-email.With PNPM:.$ pnpm mount vue-email.Developing email theme.Make a brand new e-mail template in wherever you want to possess your themes, for this instance, our team can produce a layout directory, with a theme phoned welcome.vue.src/templates/welcome. vue.

label, welcome to vue-email.A Vue component library for structure reactive emails.Sight on GitHub.Pleased coding!David Arenas.
Making the design templates.Our team may utilize the provide functionality, it gets pair of params, the 1st one is the layout to render, and also the second the params to become made use of for the theme, and after that pass the outcome design template in the body of demand.Passing the template in the body system, offer us the odds of rendering using any sort of hosting server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Placed e-mail.
Send out email.Within this example i using nuxt v3 because it enables our company to specify api inside very own venture, and describe a number of api paths.Listed here our company merely remove the template of the demand body, and also deliver the e-mail passing the layout in the sendMail function of the nodemailer package.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const physical body = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.safe: misleading,.auth: customer: testAccount.user,.pass: testAccount.pass,.,. ).const options = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there world',.html: body.template,..wait for transporter.sendMail( choices). ).If you are actually not making use of the server in nuxt, you may easily implement on any type of structure for example making use of express:.import reveal coming from 'express'.import nodemailer coming from 'nodemailer'.const application = express().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.protected: untrue,.auth: individual: testAccount.user,.successfully pass: testAccount.pass,.,. ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there planet',.html: design template,..await transporter.sendMail( choices).gain res.json( notification: "Email sent" ). ).app.listen( 3001 ).Records.Receive the total documents [listed here] ().Components.You can observe the components, listed here:.Integrations.E-mails built along with vue-email can be converted into HTML or even.clear text, and also sent utilizing any type of e-mail company. You can observe.instances here:.