Sleep

Vue- Email - Vue.js Feed

.Vue-email is motivated by react-email, it permits our company make layouts utilizing the vue platform, with components that assist our team create themes simply and also quickly.To start making use of vue-email in any type of vue job, you only need to install the deal:.With NPM:.$ npm set up vue-email.Along with Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm put up vue-email.Producing e-mail layout.Make a new e-mail layout in everywhere you wish to possess your layouts, for this instance, our company may produce a template file, with a theme gotten in touch with welcome.vue.src/templates/welcome. vue.

title, welcome to vue-email.A Vue element public library for structure reactive emails.View on GitHub.Pleased coding!David Arenas.
Rendering the templates.We can easily use the make functionality, it acquires pair of params, the very first one is the layout to render, and also the second the params to be used for the layout, and then pass the end result design template in the body system of demand.Passing the template in the physical body, offer our team the odds of providing making use of any server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver email along with nodemailer.Shipped email.
Send email.In this instance i utilizing nuxt v3 because it permits us to set api inside personal job, and also describe a number of api options.Listed below we simply draw out the template of the request body system, as well as deliver the e-mail passing the layout in the sendMail feature of the nodemailer package.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const body = await readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi world',.html: body.template,..await transporter.sendMail( options). ).If you are actually certainly not making use of the web server in nuxt, you may conveniently execute on any sort of platform for example utilizing share:.import express coming from 'express'.bring in nodemailer from 'nodemailer'.const application = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( lot: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings world',.html: layout,..wait for transporter.sendMail( options).gain res.json( message: "Email delivered" ). ).app.listen( 3001 ).Records.Acquire the complete documentation [here] ().Components.You may see the elements, listed here:.Assimilations.E-mails built along with vue-email could be exchanged HTML or even.clear text, and also sent out using any kind of email specialist. You can easily see.examples here:.