Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually motivated by react-email, it permits our team develop templates making use of the vue framework, with components that assist our company build themes conveniently and fast.To begin using vue-email in any sort of vue job, you just need to have to put up the deal:.With NPM:.$ npm mount vue-email.Along with Yarn:.$ yarn include vue-email.Along with PNPM:.$ pnpm mount vue-email.Producing email layout.Make a new e-mail layout in wherever you want to possess your templates, for this instance, our company can easily create a design template file, along with a layout gotten in touch with welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component library for structure receptive e-mails.Sight on GitHub.Satisfied coding!David Arenas.
Providing the themes.Our experts can easily use the make function, it gets pair of params, the 1st one is the template to make, and the second the params to be used for the theme, and after that pass the result template in the body of request.Passing the design template in the body system, give us the odds of making making use of any type of hosting server, express, fastify, nuxt in SSR, etc src/pages/index. vue.Send email with nodemailer.Emailed email.
Deliver e-mail.In this particular instance i making use of nuxt v3 since it enables us to establish api inside personal job, and describe various api options.Below we only extract the layout of the demand physical body, and also send out the e-mail passing the template in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const body = await readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello there globe',.html: body.template,..await transporter.sendMail( choices). ).If you are actually certainly not using the web server in nuxt, you may effortlessly execute on any sort of structure for instance making use of share:.bring share coming from 'express'.bring in nodemailer from 'nodemailer'.const app = reveal().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( 'smtp.ethereal.email',.slot: 587,.protected: incorrect,.auth: customer: testAccount.user,.successfully pass: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there globe',.html: theme,..wait for transporter.sendMail( choices).return res.json( message: "Email sent out" ). ).app.listen( 3001 ).Documents.Receive the total documents [below] ().Elements.You can observe the components, listed below:.Integrations.Emails created along with vue-email may be converted into HTML or even.clear text, as well as sent using any kind of email specialist. You may see.instances listed below:.