Sleep

Vue- Email - Vue.js Supplied

.Vue-email is inspired by react-email, it allows us develop layouts making use of the vue framework, with parts that aid our team develop themes easily as well as fast.To start making use of vue-email in any vue job, you simply need to have to put in the deal:.With NPM:.$ npm put in vue-email.With Anecdote:.$ yarn incorporate vue-email.With PNPM:.$ pnpm put up vue-email.Generating email layout.Develop a brand-new email theme in everywhere you want to have your layouts, for this instance, our team can generate a theme folder, with a template gotten in touch with welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue element public library for building responsive e-mails.Viewpoint on GitHub.Happy coding!David Arenas.
Leaving the design templates.Our team can utilize the make functionality, it acquires 2 params, the very first one is actually the layout to render, and also the 2nd the params to become made use of for the template, and afterwards pass the end result template in the body system of ask for.Passing the design template in the body, provide our company the opportunity of providing making use of any type of server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver email with nodemailer.Delivered e-mail.
Deliver e-mail.Within this example i making use of nuxt v3 because it enables our company to prepare api inside very own venture, and describe multiple api options.Listed here we simply remove the theme of the ask for body, and send the email passing the theme in the sendMail feature of the nodemailer bundle.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body = await readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( host: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there planet',.html: body.template,..await transporter.sendMail( choices). ).If you are certainly not using the server in nuxt, you may easily execute on any structure as an example utilizing express:.import show coming from 'share'.bring in nodemailer from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( multitude: process.env.HOST ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello there planet',.html: template,..await transporter.sendMail( alternatives).yield res.json( notification: "Email sent" ). ).app.listen( 3001 ).Documentation.Get the complete records [right here] ().Elements.You may observe the parts, listed here:.Integrations.E-mails developed with vue-email can be converted into HTML or.clear text, and also sent utilizing any type of email service provider. You can easily find.examples listed below:.

Articles You Can Be Interested In