Sleep

Vue- Email - Vue.js Feed

.Vue-email is influenced by react-email, it enables our team generate layouts utilizing the vue framework, with parts that aid our team build templates quickly as well as fast.To begin utilizing vue-email in any kind of vue job, you merely need to mount the plan:.With NPM:.$ npm install vue-email.With Yarn:.$ yarn add vue-email.Along with PNPM:.$ pnpm set up vue-email.Producing e-mail theme.Produce a brand new e-mail design template in no matter where you desire to possess your design templates, for this case, our experts may generate a design template file, along with a theme called welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue element public library for structure receptive emails.Perspective on GitHub.Happy coding!David Arenas.
Providing the themes.Our team can easily make use of the provide function, it gets two params, the first one is the template to provide, and also the second the params to become used for the theme, and then pass the end result design template in the body of demand.Passing the design template in the body system, offer our team the odds of making utilizing any sort of server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Send email along with nodemailer.Directed email.
Deliver email.In this particular example i utilizing nuxt v3 since it permits our team to establish api inside personal project, and describe a number of api paths.Below we only remove the layout of the ask for physical body, and deliver the email passing the layout in the sendMail functionality of the nodemailer package.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body system = await readBody( event).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( lot: process.env.HOST ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hello planet',.html: body.template,..await transporter.sendMail( choices). ).If you are actually certainly not utilizing the server in nuxt, you can simply implement on any sort of platform for example using share:.import share from 'express'.import nodemailer from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there globe',.html: design template,..wait for transporter.sendMail( possibilities).gain res.json( information: "Email delivered" ). ).app.listen( 3001 ).Records.Get the complete paperwork [below] ().Parts.You may view the components, listed here:.Combinations.E-mails developed along with vue-email can be converted into HTML or even.clear text, as well as sent using any sort of e-mail service provider. You can view.examples right here:.

Articles You Can Be Interested In