Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually motivated through react-email, it allows our company make design templates utilizing the vue framework, with components that aid our team develop design templates simply as well as fast.To begin making use of vue-email in any type of vue project, you simply need to have to put up the package:.Along with NPM:.$ npm install vue-email.With Anecdote:.$ yarn include vue-email.Along with PNPM:.$ pnpm set up vue-email.Making e-mail design template.Generate a brand new email theme in any place you intend to possess your themes, for this case, our team can easily generate a layout folder, along with a design template called welcome.vue.src/templates/welcome. vue.

label, invited to vue-email.A Vue component collection for property receptive emails.View on GitHub.Satisfied coding!David Arenas.
Rendering the themes.Our experts may make use of the make function, it gets 2 params, the first one is the layout to provide, and the second the params to become utilized for the design template, and then pass the end result template in the body of demand.Passing the theme in the body, provide our company the opportunity of providing utilizing any sort of web server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver e-mail along with nodemailer.Posted email.
Deliver email.Within this instance i using nuxt v3 because it permits our team to specify api inside own job, and describe multiple api options.Right here our company merely draw out the design template of the request body, as well as send out the e-mail passing the layout in the sendMail function of the nodemailer plan.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const body = await readBody( event).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( multitude: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi there world',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually certainly not making use of the server in nuxt, you may quickly apply on any kind of structure as an example utilizing reveal:.import show coming from 'convey'.bring in nodemailer from 'nodemailer'.const application = 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: 'hi there world',.html: layout,..wait for transporter.sendMail( options).profit res.json( message: "Email sent out" ). ).app.listen( 3001 ).Documentation.Acquire the complete paperwork [listed here] ().Components.You can observe the components, listed here:.Assimilations.Emails developed along with vue-email may be exchanged HTML or.plain text, as well as sent utilizing any type of email specialist. You may view.examples listed below:.

Articles You Can Be Interested In