Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually influenced by react-email, it enables our team generate templates utilizing the vue framework, with parts that help us develop design templates conveniently and fast.To begin utilizing vue-email in any kind of vue task, you merely need to mount the bundle:.With NPM:.$ npm install vue-email.Along with Yarn:.$ yarn add vue-email.With PNPM:.$ pnpm mount vue-email.Generating email theme.Make a new email design template in any place you desire to possess your templates, for this instance, our company can easily develop a design template folder, with a theme contacted welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue element public library for property reactive e-mails.Scenery on GitHub.Pleased coding!David Arenas.
Making the layouts.Our experts may utilize the make functionality, it obtains two params, the initial one is the theme to leave, as well as the 2nd the params to become utilized for the template, and then pass the result design template in the physical body of ask for.Passing the template in the body system, provide our team the possibility of making utilizing any sort of web server, share, fastify, nuxt in SSR, and so on src/pages/index. vue.Send e-mail with nodemailer.Routed email.
Deliver email.Within this instance i using nuxt v3 since it enables our company to establish api inside very own task, and describe multiple api routes.Listed here we only extract the template of the ask for body system, and deliver the e-mail passing the theme in the sendMail feature of the nodemailer deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (occasion) =&gt const physical body = wait for readBody( event).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello planet',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually not making use of the hosting server in nuxt, you may quickly apply on any type of platform for instance utilizing share:.bring reveal 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 layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.secure: false,.auth: customer: testAccount.user,.pass: testAccount.pass,.,. ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there planet',.html: theme,..await transporter.sendMail( options).profit res.json( information: "Email sent out" ). ).app.listen( 3001 ).Documents.Receive the full documents [listed below] ().Elements.You can easily view the elements, listed below:.Assimilations.Emails created along with vue-email could be exchanged HTML or even.clear text, and sent out making use of any sort of email provider. You may see.instances below:.