Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually inspired by react-email, it enables our company develop design templates using the vue platform, along with elements that assist our team construct design templates conveniently as well as swiftly.To start making use of vue-email in any vue job, you just require to mount the package:.Along with NPM:.$ npm mount vue-email.With Anecdote:.$ anecdote include vue-email.Along with PNPM:.$ pnpm put in vue-email.Making email design template.Develop a brand new email theme in everywhere you want to possess your layouts, for this situation, we can create a template file, with a template contacted welcome.vue.src/templates/welcome. vue.

label, appreciated to vue-email.A Vue part collection for property receptive emails.Scenery on GitHub.Satisfied coding!David Arenas.
Providing the templates.Our experts can easily utilize the provide functionality, it obtains pair of params, the initial one is actually the layout to leave, and the second the params to be made use of for the layout, and after that pass the result theme in the body system of ask for.Passing the template in the body, offer our team the possibility of providing utilizing any type of hosting server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Send email along with nodemailer.Placed email.
Send out e-mail.In this instance i using nuxt v3 since it allows our team to establish api inside own venture, as well as specify a number of api routes.Listed below our company only extract the template of the request physical body, and deliver the e-mail passing the template in the sendMail feature of the nodemailer deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const physical body = await readBody( activity).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello there planet',.html: body.template,..await transporter.sendMail( choices). ).If you are certainly not utilizing the server in nuxt, you may quickly execute on any platform as an example utilizing express:.import share from 'share'.import nodemailer coming from 'nodemailer'.const application = convey().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( 'smtp.ethereal.email',.slot: 587,.safe and secure: inaccurate,.auth: user: testAccount.user,.elapsed: testAccount.pass,.,. ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there world',.html: design template,..wait for transporter.sendMail( choices).profit res.json( message: "Email sent" ). ).app.listen( 3001 ).Paperwork.Receive the complete paperwork [listed below] ().Components.You may find the elements, listed here:.Assimilations.E-mails created with vue-email may be exchanged HTML or.clear text, and sent out using any e-mail company. You can find.examples listed below:.