Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced by react-email, it allows our team develop templates utilizing the vue framework, along with components that help our team build design templates effortlessly and quick.To start making use of vue-email in any kind of vue venture, you simply need to put in the deal:.With NPM:.$ npm put in vue-email.With Yarn:.$ yarn add vue-email.With PNPM:.$ pnpm install vue-email.Generating e-mail theme.Develop a brand-new email design template in any place you wish to possess your layouts, for this instance, our team can create a theme file, along with a layout gotten in touch with welcome.vue.src/templates/welcome. vue.

label, appreciated to vue-email.A Vue part public library for building receptive e-mails.Sight on GitHub.Pleased coding!David Arenas.
Providing the themes.Our company can easily use the leave function, it obtains 2 params, the initial one is actually the template to leave, as well as the second the params to become made use of for the design template, and afterwards pass the result template in the body of request.Passing the template in the body, provide our company the odds of providing using any sort of server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Send e-mail along with nodemailer.Shipped e-mail.
Send e-mail.Within this instance i making use of nuxt v3 due to the fact that it enables our team to set api inside personal task, and determine a number of api options.Listed below we just draw out the template of the demand body system, and also deliver the email passing the design template in the sendMail feature of the nodemailer package.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const body system = await readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there world',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are actually not using the web server in nuxt, you may easily carry out on any kind of structure for example making use of express:.import convey from 'share'.import 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 = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello planet',.html: layout,..wait for transporter.sendMail( choices).yield res.json( message: "Email sent" ). ).app.listen( 3001 ).Paperwork.Obtain the full information [right here] ().Components.You can view the components, listed here:.Assimilations.Emails built with vue-email can be exchanged HTML or.plain text, and sent using any kind of e-mail specialist. You may view.instances below:.