Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually influenced through react-email, it enables our company produce themes making use of the vue platform, with parts that aid our company construct design templates easily and also quick.To begin making use of vue-email in any vue job, you only need to mount the bundle:.With NPM:.$ npm set up vue-email.With Yarn:.$ anecdote incorporate vue-email.With PNPM:.$ pnpm put up vue-email.Creating e-mail theme.Develop a new e-mail theme in anywhere you desire to possess your design templates, for this scenario, we can easily make a theme file, with a template contacted welcome.vue.src/templates/welcome. vue.

label, appreciated to vue-email.A Vue component collection for property responsive e-mails.View on GitHub.Happy coding!David Arenas.
Making the design templates.Our experts can easily utilize the render feature, it receives pair of params, the 1st one is the layout to provide, and the 2nd the params to be used for the layout, and after that pass the outcome design template in the physical body of request.Passing the theme in the body system, give our company the possibility of leaving utilizing any kind of hosting server, reveal, fastify, nuxt in SSR, and so on src/pages/index. vue.Send email along with nodemailer.Delivered email.
Send e-mail.In this instance i using nuxt v3 given that it allows our team to establish api inside personal venture, and define a number of api paths.Right here our team just remove the layout of the request body, and also send the email passing the layout in the sendMail function of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const physical body = await readBody( occasion).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi globe',.html: body.template,..wait for transporter.sendMail( choices). ).If you are actually certainly not utilizing the server in nuxt, you may effortlessly carry out on any sort of framework for example utilizing show:.bring reveal coming from 'convey'.import nodemailer coming from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there planet',.html: layout,..wait for transporter.sendMail( alternatives).profit res.json( message: "Email sent" ). ).app.listen( 3001 ).Paperwork.Acquire the complete paperwork [listed here] ().Elements.You can easily observe the parts, listed below:.Combinations.Emails built with vue-email may be converted into HTML or.plain text, and sent making use of any sort of e-mail specialist. You can easily find.instances below:.