Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually influenced by react-email, it allows our company develop templates utilizing the vue platform, with elements that help us develop templates easily and also fast.To begin making use of vue-email in any type of vue task, you merely need to put up the deal:.With NPM:.$ npm put in vue-email.With Anecdote:.$ yarn add vue-email.With PNPM:.$ pnpm set up vue-email.Creating email design template.Develop a brand-new email theme in any place you desire to have your themes, for this scenario, our team can create a template file, along with a template called welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue element library for property reactive emails.Sight on GitHub.Happy coding!David Arenas.
Providing the layouts.We can easily utilize the leave feature, it obtains two params, the very first one is the template to provide, as well as the second the params to be made use of for the template, and afterwards pass the result theme in the physical body of demand.Passing the layout in the body, give us the possibility of leaving using any type of server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email with nodemailer.Delivered email.
Deliver email.Within this instance i making use of nuxt v3 considering that it permits our company to specify api inside own venture, and also specify various api options.Right here our experts just extract the template of the request body system, and also send out the e-mail passing the theme in the sendMail functionality of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const body = await readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings world',.html: body.template,..wait for transporter.sendMail( choices). ).If you are certainly not making use of the hosting server in nuxt, you can easily implement on any kind of platform as an example utilizing convey:.import reveal from 'convey'.import nodemailer coming from 'nodemailer'.const application = 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( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello there planet',.html: template,..wait for transporter.sendMail( choices).return res.json( message: "Email sent out" ). ).app.listen( 3001 ).Paperwork.Get the total records [here] ().Elements.You can easily view the parts, listed here:.Integrations.E-mails built along with vue-email may be converted into HTML or.clear text, and also sent utilizing any type of email service provider. You can find.examples right here:.