Sleep

Vue- Email - Vue.js Supplied

.Vue-email is encouraged through react-email, it allows our company produce themes making use of the vue platform, with parts that assist us develop themes quickly and also fast.To start making use of vue-email in any vue project, you only need to put in the package deal:.With NPM:.$ npm put in vue-email.Along with Yarn:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm mount vue-email.Making email theme.Create a brand new email theme in any place you would like to have your layouts, for this instance, our experts may make a layout folder, along with a design template called welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue part collection for property reactive e-mails.Scenery on GitHub.Delighted coding!David Arenas.
Leaving the layouts.Our experts may utilize the make function, it gets 2 params, the first one is actually the layout to make, and the second the params to be made use of for the layout, and afterwards pass the end result theme in the physical body of request.Passing the template in the body, give our team the possibility of leaving making use of any sort of server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email along with nodemailer.Mailed e-mail.
Send email.In this instance i using nuxt v3 since it permits our team to prepare api inside own project, and also describe a number of api paths.Listed below our company simply extract the design template of the request body system, as well as send the email passing the template in the sendMail function of the nodemailer package.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const body = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.safe: inaccurate,.auth: individual: testAccount.user,.elapsed: testAccount.pass,.,. ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there world',.html: body.template,..wait for transporter.sendMail( choices). ).If you are not utilizing the hosting server in nuxt, you can conveniently carry out on any sort of framework as an example making use of share:.bring express coming from 'express'.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 = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings planet',.html: theme,..await transporter.sendMail( possibilities).return res.json( information: "Email sent out" ). ).app.listen( 3001 ).Paperwork.Get the complete documents [below] ().Components.You can easily view the parts, listed below:.Integrations.Emails created along with vue-email may be converted into HTML or even.plain text, as well as delivered making use of any type of email specialist. You can easily observe.instances below:.