Sleep

Vue- Email - Vue.js Feed

.Vue-email is inspired through react-email, it enables our company make design templates using the vue platform, along with parts that aid us construct themes conveniently as well as fast.To begin using vue-email in any sort of vue job, you just need to have to put up the plan:.With NPM:.$ npm put in vue-email.With Anecdote:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm put in vue-email.Creating e-mail design template.Create a brand new email template in no matter where you want to have your layouts, for this case, our experts can develop a design template directory, with a theme contacted welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue part collection for building responsive emails.Sight on GitHub.Pleased coding!David Arenas.
Leaving the layouts.Our experts can easily use the make feature, it acquires two params, the 1st one is the theme to provide, and the 2nd the params to become utilized for the theme, and afterwards pass the end result layout in the physical body of demand.Passing the layout in the body system, provide our team the odds of providing utilizing any kind of server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver email with nodemailer.Provided email.
Send out e-mail.In this example i using nuxt v3 since it allows our company to specify api inside personal job, and specify multiple api routes.Right here our experts only draw out the layout of the demand body system, as well as deliver the email passing the template in the sendMail functionality of the nodemailer package.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const body = await readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi there planet',.html: body.template,..await transporter.sendMail( alternatives). ).If you are certainly not utilizing the server in nuxt, you can effortlessly implement on any sort of platform as an example using express:.import show from 'show'.import nodemailer coming from 'nodemailer'.const application = convey().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( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings world',.html: theme,..await transporter.sendMail( possibilities).gain res.json( information: "Email delivered" ). ).app.listen( 3001 ).Information.Get the full records [listed below] ().Parts.You can easily see the elements, listed here:.Assimilations.E-mails constructed along with vue-email may be exchanged HTML or.plain text, and delivered using any kind of e-mail company. You may find.examples listed below:.