Sleep

Vue- Email - Vue.js Nourished

.Vue-email is inspired through react-email, it allows our team make layouts making use of the vue framework, along with components that aid us construct design templates simply and quick.To begin utilizing vue-email in any vue task, you simply need to have to install the package deal:.Along with NPM:.$ npm put in vue-email.With Yarn:.$ anecdote add vue-email.With PNPM:.$ pnpm set up vue-email.Producing e-mail design template.Develop a brand-new e-mail theme in no matter where you desire to have your design templates, for this case, our team can easily develop a layout folder, with a theme phoned welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue element public library for property receptive e-mails.Viewpoint on GitHub.Happy coding!David Arenas.
Making the themes.Our company can easily utilize the render feature, it receives 2 params, the initial one is the theme to render, and the 2nd the params to be made use of for the layout, and afterwards pass the end result template in the physical body of request.Passing the template in the body, provide our company the chance of rendering utilizing any sort of hosting server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Send email with nodemailer.Provided email.
Send e-mail.Within this example i utilizing nuxt v3 given that it permits our company to specify api inside own task, and also specify numerous api courses.Listed below we just draw out the template of the ask for body, and deliver the e-mail passing the theme in the sendMail feature of the nodemailer deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const body = await readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.safe and secure: false,.auth: customer: testAccount.user,.elapsed: testAccount.pass,.,. ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi world',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are actually certainly not utilizing the hosting server in nuxt, you can effortlessly carry out on any type of structure for instance utilizing share:.bring show from 'convey'.import nodemailer coming from 'nodemailer'.const application = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello globe',.html: theme,..await transporter.sendMail( alternatives).yield res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Records.Acquire the complete documents [right here] ().Parts.You can easily observe the parts, listed here:.Assimilations.Emails built along with vue-email could be exchanged HTML or.clear text, and also sent using any e-mail provider. You can easily find.examples here:.