Sleep

Vue- Email - Vue.js Feed

.Vue-email is inspired by react-email, it allows our team generate design templates making use of the vue platform, with parts that help our team construct design templates simply and quickly.To start utilizing vue-email in any vue venture, you merely need to have to put in the bundle:.With NPM:.$ npm install vue-email.With Yarn:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm mount vue-email.Producing e-mail theme.Make a brand-new e-mail layout in no matter where you wish to have your templates, for this case, our team may make a layout file, along with a design template contacted welcome.vue.src/templates/welcome. vue.

label, welcome to vue-email.A Vue component collection for building responsive emails.Viewpoint on GitHub.Delighted coding!David Arenas.
Making the templates.Our experts can easily make use of the leave feature, it receives two params, the 1st one is the theme to render, and the 2nd the params to be utilized for the theme, and after that pass the result layout in the physical body of demand.Passing the design template in the body, provide our company the possibility of leaving utilizing any server, share, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email with nodemailer.Routed email.
Send out email.Within this instance i making use of nuxt v3 considering that it enables us to prepare api inside personal task, as well as specify numerous api courses.Below our team simply extract the template of the ask for physical body, and also deliver the e-mail passing the theme in the sendMail functionality of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const physical body = wait for readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.secure: incorrect,.auth: user: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hey there globe',.html: body.template,..wait for transporter.sendMail( options). ).If you are certainly not making use of the hosting server in nuxt, you can quickly apply on any type of platform as an example making use of share:.import express from 'share'.import nodemailer from 'nodemailer'.const app = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings globe',.html: template,..wait for transporter.sendMail( possibilities).gain res.json( notification: "Email sent" ). ).app.listen( 3001 ).Documents.Obtain the total paperwork [here] ().Parts.You may observe the parts, listed below:.Assimilations.Emails constructed along with vue-email may be exchanged HTML or even.clear text, and sent using any type of email company. You may observe.examples below:.