Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced through react-email, it permits our team develop templates making use of the vue structure, with components that help our company construct templates effortlessly as well as fast.To start utilizing vue-email in any kind of vue job, you merely need to have to install the package deal:.With NPM:.$ npm put up vue-email.With Yarn:.$ anecdote add vue-email.Along with PNPM:.$ pnpm install vue-email.Making e-mail layout.Develop a brand-new e-mail layout in wherever you desire to possess your templates, for this case, our team may generate a template folder, along with a theme phoned welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue element public library for property responsive emails.Viewpoint on GitHub.Pleased coding!David Arenas.
Leaving the design templates.Our experts can utilize the provide functionality, it obtains 2 params, the initial one is the design template to make, and the 2nd the params to be utilized for the template, and then pass the outcome theme in the body of demand.Passing the template in the physical body, provide us the chance of leaving utilizing any sort of web server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Emailed e-mail.
Deliver e-mail.In this example i making use of nuxt v3 since it allows our team to prepare api inside very own project, and also determine a number of api routes.Below our experts simply extract the template of the ask for physical body, as well as send out the e-mail passing the design template in the sendMail function of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const physical body = await readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello there globe',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually not making use of the server in nuxt, you may effortlessly implement on any kind of framework for example making use of share:.bring express coming from 'express'.bring in nodemailer from 'nodemailer'.const app = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( multitude: process.env.HOST ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello there globe',.html: design template,..wait for transporter.sendMail( alternatives).return res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Get the full documentation [below] ().Elements.You can easily find the components, listed below:.Combinations.E-mails created along with vue-email can be exchanged HTML or.plain text, and also sent out using any sort of e-mail service provider. You can view.instances listed below:.

Articles You Can Be Interested In