Sleep

Vue- Email - Vue.js Feed

.Vue-email is motivated through react-email, it allows our team create layouts making use of the vue platform, along with parts that assist us develop layouts simply and swiftly.To begin making use of vue-email in any vue project, you simply need to have to put up the deal:.Along with NPM:.$ npm put up vue-email.With Yarn:.$ yarn include vue-email.With PNPM:.$ pnpm install vue-email.Generating email theme.Develop a new email theme in wherever you wish to possess your layouts, for this situation, our experts may generate a template directory, with a template contacted welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue part collection for property receptive emails.Scenery on GitHub.Pleased coding!David Arenas.
Rendering the templates.Our team can use the render function, it receives 2 params, the initial one is the theme to provide, as well as the 2nd the params to become used for the template, and afterwards pass the end result theme in the physical body of ask for.Passing the template in the body system, offer our company the chance of providing using any type of hosting server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send email with nodemailer.Shipped email.
Send out email.In this particular instance i utilizing nuxt v3 considering that it enables our company to set api inside own job, as well as define multiple api paths.Below we only remove the design template of the ask for physical body, and also send the e-mail passing the layout in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body = wait for readBody( event).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there globe',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually not using the server in nuxt, you can easily implement on any type of structure for example using share:.bring share coming from 'express'.import nodemailer 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: consumer: testAccount.user,.elapsed: testAccount.pass,.,. ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi world',.html: template,..wait for transporter.sendMail( alternatives).profit res.json( message: "Email sent out" ). ).app.listen( 3001 ).Documentation.Get the full documents [listed below] ().Elements.You may find the parts, listed here:.Combinations.E-mails constructed along with vue-email may be exchanged HTML or.clear text, and also delivered making use of any sort of email service provider. You can view.instances here:.