Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually influenced through react-email, it permits our company create themes using the vue framework, along with elements that assist our team develop design templates easily as well as fast.To start using vue-email in any sort of vue task, you simply require to install the plan:.With NPM:.$ npm mount vue-email.With Anecdote:.$ anecdote include vue-email.With PNPM:.$ pnpm mount vue-email.Producing e-mail layout.Develop a new e-mail design template in any place you would like to have your layouts, for this case, our team can produce a template file, with a theme called welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue part library for building responsive e-mails.Scenery on GitHub.Pleased coding!David Arenas.
Rendering the themes.Our experts may utilize the leave function, it acquires pair of params, the 1st one is the design template to render, as well as the 2nd the params to be made use of for the layout, and afterwards pass the result template in the physical body of ask for.Passing the theme in the physical body, offer our company the odds of making making use of any kind of server, share, fastify, nuxt in SSR, and so on src/pages/index. vue.Send email with nodemailer.Posted email.
Send e-mail.In this instance i utilizing nuxt v3 because it allows our company to set api inside personal task, and define numerous api paths.Here our team simply draw out the theme of the demand body system, and send the e-mail passing the layout in the sendMail functionality of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const body system = await readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.protected: incorrect,.auth: user: testAccount.user,.successfully pass: testAccount.pass,.,. ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi globe',.html: body.template,..wait for transporter.sendMail( choices). ).If you are actually certainly not using the hosting server in nuxt, you may easily implement on any kind of platform for example making use of reveal:.import show coming from 'share'.import nodemailer from 'nodemailer'.const application = express().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.secure: misleading,.auth: individual: testAccount.user,.successfully pass: testAccount.pass,.,. ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings globe',.html: design template,..await transporter.sendMail( choices).gain res.json( message: "Email sent" ). ).app.listen( 3001 ).Information.Receive the complete records [right here] ().Elements.You can easily observe the parts, listed here:.Assimilations.E-mails constructed with vue-email can be exchanged HTML or.clear text, as well as sent out using any type of e-mail service provider. You can easily view.examples below:.