Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually motivated through react-email, it allows our team make design templates making use of the vue structure, with components that assist us create templates quickly and quickly.To start using vue-email in any vue job, you only require to put up the package:.With NPM:.$ npm mount vue-email.With Anecdote:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm mount vue-email.Making email template.Create a new email design template in no matter where you want to have your themes, for this scenario, our team may create a template directory, with a design template gotten in touch with welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue element library for building responsive emails.Scenery on GitHub.Pleased coding!David Arenas.
Providing the themes.Our company can easily utilize the render feature, it acquires pair of params, the first one is actually the theme to leave, and the second the params to be utilized for the design template, and then pass the result layout in the physical body of demand.Passing the design template in the body system, offer our team the odds of leaving utilizing any sort of hosting server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send email with nodemailer.Directed e-mail.
Send out email.In this particular example i using nuxt v3 since it permits us to prepare api inside very own job, and describe a number of api paths.Right here our experts only draw out the theme of the demand body, as well as deliver the email passing the layout in the sendMail feature of the nodemailer deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const body = wait for readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi there planet',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are not making use of the server in nuxt, you may simply execute on any kind of framework as an example making use of show:.import share from 'reveal'.bring in nodemailer coming from 'nodemailer'.const app = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( multitude: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there globe',.html: design template,..await transporter.sendMail( alternatives).profit res.json( message: "Email sent" ). ).app.listen( 3001 ).Information.Acquire the complete records [listed here] ().Parts.You can observe the components, listed here:.Integrations.E-mails developed along with vue-email can be converted into HTML or.plain text, and also sent using any sort of e-mail provider. You may see.examples right here:.

Articles You Can Be Interested In