Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually encouraged by react-email, it allows our company generate design templates using the vue framework, with components that help our company develop themes easily as well as quick.To start using vue-email in any type of vue task, you merely need to put up the package deal:.Along with NPM:.$ npm install vue-email.With Anecdote:.$ yarn include vue-email.Along with PNPM:.$ pnpm set up vue-email.Producing email theme.Generate a brand new e-mail design template in no matter where you want to possess your design templates, for this case, our experts can make a layout folder, with a theme contacted welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue part library for building responsive e-mails.View on GitHub.Pleased coding!David Arenas.
Making the layouts.Our experts may use the provide feature, it gets two params, the first one is the design template to make, and the 2nd the params to be utilized for the theme, and after that pass the result design template in the body of ask for.Passing the design template in the body, give us the odds of rendering utilizing any kind of web server, express, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail along with nodemailer.Posted email.
Send out e-mail.In this instance i making use of nuxt v3 because it permits us to establish api inside personal task, as well as define multiple api courses.Listed here our experts just remove the theme of the ask for body, as well as deliver the email passing the template in the sendMail feature of the nodemailer package.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (occasion) =&gt const body = await readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there globe',.html: body.template,..await transporter.sendMail( options). ).If you are actually not utilizing the server in nuxt, you can simply execute on any sort of platform for example utilizing reveal:.bring share coming from 'convey'.import nodemailer coming from 'nodemailer'.const app = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello there globe',.html: theme,..await transporter.sendMail( possibilities).yield res.json( information: "Email sent out" ). ).app.listen( 3001 ).Paperwork.Acquire the complete paperwork [here] ().Parts.You can easily find the elements, listed below:.Combinations.E-mails created along with vue-email can be converted into HTML or even.plain text, and also sent out utilizing any kind of email service provider. You can easily observe.examples here:.

Articles You Can Be Interested In