Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually motivated by react-email, it allows our team create layouts utilizing the vue platform, along with parts that help us construct layouts conveniently and swiftly.To begin utilizing vue-email in any type of vue venture, you merely require to install the deal:.Along with NPM:.$ npm install vue-email.Along with Anecdote:.$ anecdote add vue-email.With PNPM:.$ pnpm install vue-email.Making email template.Make a brand new email template in anywhere you wish to possess your layouts, for this case, our company can easily create a template directory, along with a design template contacted welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue part collection for property responsive emails.Sight on GitHub.Pleased coding!David Arenas.
Leaving the design templates.Our team may make use of the make feature, it receives two params, the initial one is the template to provide, and the 2nd the params to be utilized for the layout, and afterwards pass the end result theme in the physical body of demand.Passing the theme in the body system, provide our company the chance of making utilizing any kind of hosting server, share, fastify, nuxt in SSR, and so on src/pages/index. vue.Send e-mail with nodemailer.Provided e-mail.
Deliver email.Within this instance i using nuxt v3 given that it permits us to establish api inside personal project, and define multiple api paths.Below our experts simply draw out the layout of the request body system, and send out the email passing the layout in the sendMail function of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const physical body = wait for readBody( celebration).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe: untrue,.auth: user: testAccount.user,.pass: testAccount.pass,.,. ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi globe',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are not utilizing the server in nuxt, you can simply implement on any kind of framework for example utilizing reveal:.import reveal coming from 'reveal'.bring in nodemailer coming from 'nodemailer'.const application = 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( 'smtp.ethereal.email',.port: 587,.safe and secure: false,.auth: customer: testAccount.user,.successfully pass: testAccount.pass,.,. ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi globe',.html: template,..wait for transporter.sendMail( possibilities).gain res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Information.Acquire the complete records [listed here] ().Elements.You can easily view the components, listed below:.Integrations.E-mails developed along with vue-email can be converted into HTML or.clear text, and also sent utilizing any type of e-mail specialist. You can easily see.instances below:.

Articles You Can Be Interested In