Sleep

Vue- Email - Vue.js Feed

.Vue-email is motivated by react-email, it allows our team produce templates utilizing the vue platform, with components that assist our company create layouts easily and swiftly.To begin utilizing vue-email in any kind of vue task, you only require to set up the package deal:.Along with NPM:.$ npm mount vue-email.With Yarn:.$ yarn add vue-email.With PNPM:.$ pnpm install vue-email.Making e-mail template.Produce a brand-new e-mail design template in wherever you want to have your layouts, for this case, our company can easily make a theme file, along with a design template called welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue element collection for structure reactive emails.Perspective on GitHub.Satisfied coding!David Arenas.
Rendering the themes.Our experts can use the leave functionality, it obtains pair of params, the 1st one is actually the theme to render, and the second the params to become made use of for the theme, and then pass the outcome design template in the body system of request.Passing the theme in the physical body, offer us the chance of making utilizing any kind of server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email with nodemailer.Emailed email.
Send out e-mail.In this particular instance i utilizing nuxt v3 since it allows our company to specify api inside personal task, and determine various api courses.Right here our team simply remove the template of the demand body system, as well as deliver the e-mail passing the template in the sendMail feature of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (occasion) =&gt const body = await readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there world',.html: body.template,..wait for transporter.sendMail( choices). ).If you are certainly not using the server in nuxt, you may simply implement on any kind of structure for example utilizing express:.bring reveal from 'express'.bring in nodemailer coming from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there world',.html: theme,..await transporter.sendMail( possibilities).profit res.json( message: "Email sent" ). ).app.listen( 3001 ).Paperwork.Obtain the complete records [here] ().Elements.You may view the elements, listed below:.Integrations.E-mails developed along with vue-email could be converted into HTML or even.plain text, and delivered utilizing any kind of email specialist. You can easily view.examples here:.

Articles You Can Be Interested In