Sleep

Vue- Email - Vue.js Feed

.Vue-email is motivated through react-email, it enables our company produce themes utilizing the vue structure, with components that help our team build layouts quickly and quickly.To begin making use of vue-email in any vue job, you just need to have to mount the package:.With NPM:.$ npm put up vue-email.Along with Anecdote:.$ yarn include vue-email.With PNPM:.$ pnpm put up vue-email.Making email design template.Make a new email template in no matter where you desire to have your design templates, for this scenario, our company may produce a design template folder, with a template gotten in touch with welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue component collection for property receptive e-mails.Perspective on GitHub.Happy coding!David Arenas.
Rendering the themes.Our team can easily utilize the render function, it obtains two params, the very first one is the design template to render, and the second the params to be utilized for the template, and then pass the result template in the body system of ask for.Passing the template in the body, offer our company the odds of leaving utilizing any server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail along with nodemailer.Posted e-mail.
Send out e-mail.Within this instance i making use of nuxt v3 due to the fact that it allows our team to specify api inside very own venture, and specify several api options.Listed here our team merely extract the template of the demand physical body, and also send out the email passing the layout in the sendMail functionality of the nodemailer deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (occasion) =&gt const body = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.protected: inaccurate,.auth: user: testAccount.user,.successfully pass: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello there globe',.html: body.template,..await transporter.sendMail( options). ).If you are actually certainly not using the web server in nuxt, you can easily carry out on any kind of platform for instance utilizing convey:.import express coming from 'express'.bring in nodemailer from 'nodemailer'.const application = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.secure: false,.auth: individual: testAccount.user,.successfully pass: testAccount.pass,.,. ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there globe',.html: theme,..wait for transporter.sendMail( possibilities).gain res.json( message: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Acquire the complete information [listed here] ().Elements.You can easily view the elements, listed below:.Integrations.Emails constructed with vue-email may be exchanged HTML or even.clear text, as well as delivered making use of any sort of e-mail specialist. You can see.instances listed here:.

Articles You Can Be Interested In