Sleep

Vue- Email - Vue.js Nourished

.Vue-email is influenced by react-email, it permits us create layouts making use of the vue structure, with elements that aid our company develop themes conveniently and also quick.To begin using vue-email in any kind of vue project, you just need to have to put up the plan:.Along with NPM:.$ npm put in vue-email.With Yarn:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm install vue-email.Producing email theme.Develop a brand new email layout in anywhere you would like to have your templates, for this situation, we may create a template folder, with a layout gotten in touch with welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue part library for structure responsive e-mails.View on GitHub.Pleased coding!David Arenas.
Rendering the layouts.Our team can easily utilize the leave feature, it obtains two params, the first one is the layout to render, and the 2nd the params to be used for the template, and afterwards pass the result theme in the physical body of ask for.Passing the layout in the physical body, offer us the odds of making making use of any type of server, share, fastify, nuxt in SSR, and so on src/pages/index. vue.Send email along with nodemailer.Placed e-mail.
Send out e-mail.Within this instance i making use of nuxt v3 due to the fact that it permits our team to set api inside own job, and determine a number of api courses.Below our company only draw out the theme of the request body system, and send the email passing the theme in the sendMail functionality of the nodemailer deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body system = await readBody( celebration).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello world',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are not making use of the web server in nuxt, you can simply apply on any structure as an example utilizing share:.bring reveal coming from 'share'.import nodemailer 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 choices = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello world',.html: design template,..wait for transporter.sendMail( alternatives).gain res.json( information: "Email delivered" ). ).app.listen( 3001 ).Documentation.Acquire the full paperwork [below] ().Elements.You can see the elements, listed here:.Assimilations.Emails developed with vue-email can be converted into HTML or even.clear text, and also sent using any e-mail specialist. You can easily find.examples below:.