Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced by react-email, it permits our company produce themes utilizing the vue platform, with parts that help our company create themes conveniently and swiftly.To start using vue-email in any kind of vue task, you simply need to have to put up the package:.With NPM:.$ npm put up vue-email.With Anecdote:.$ yarn add vue-email.With PNPM:.$ pnpm install vue-email.Producing e-mail design template.Develop a brand new email layout in no matter where you intend to have your templates, for this instance, we may generate a design template directory, along with a template called welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue part library for structure receptive e-mails.Perspective on GitHub.Delighted coding!David Arenas.
Leaving the layouts.Our experts may use the make functionality, it obtains 2 params, the initial one is actually the template to provide, and the 2nd the params to be used for the theme, and then pass the end result theme in the physical body of demand.Passing the theme in the physical body, offer our team the possibility of rendering making use of any server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Send email with nodemailer.Emailed e-mail.
Send e-mail.Within this instance i utilizing nuxt v3 given that it permits us to establish api inside very own job, and specify numerous api paths.Listed here our company just draw out the theme of the request body system, and send out the e-mail passing the design template in the sendMail feature of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const body = wait for readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( host: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there globe',.html: body.template,..await transporter.sendMail( possibilities). ).If you are certainly not utilizing the hosting server in nuxt, you can conveniently execute on any sort of platform as an example using show:.import share coming from 'share'.bring in nodemailer from 'nodemailer'.const application = share().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( 'smtp.ethereal.email',.slot: 587,.safe and secure: incorrect,.auth: individual: testAccount.user,.elapsed: testAccount.pass,.,. ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello globe',.html: template,..wait for transporter.sendMail( possibilities).return res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Receive the total paperwork [here] ().Parts.You can easily see the elements, listed here:.Integrations.E-mails constructed along with vue-email may be converted into HTML or even.clear text, as well as delivered making use of any kind of e-mail provider. You can view.examples listed here:.