Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually encouraged through react-email, it permits our company make themes making use of the vue framework, with parts that assist our company create themes simply and also fast.To begin using vue-email in any sort of vue task, you only need to have to put in the plan:.Along with NPM:.$ npm mount vue-email.With Anecdote:.$ yarn add vue-email.With PNPM:.$ pnpm install vue-email.Producing email design template.Create a new email theme in everywhere you desire to have your design templates, for this scenario, our experts may make a layout directory, with a template gotten in touch with welcome.vue.src/templates/welcome. vue.

label, appreciated to vue-email.A Vue element collection for building reactive e-mails.Viewpoint on GitHub.Happy coding!David Arenas.
Rendering the themes.We may utilize the make functionality, it gets 2 params, the initial one is the design template to provide, as well as the 2nd the params to be used for the theme, and after that pass the outcome template in the physical body of ask for.Passing the layout in the body, give us the possibility of providing making use of any sort of server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email along with nodemailer.Dispatched e-mail.
Send email.In this instance i using nuxt v3 considering that it allows our company to set api inside personal project, as well as determine multiple api options.Listed here our company merely extract the design template of the request physical body, and send out the email passing the design template in the sendMail functionality of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body = wait for readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings planet',.html: body.template,..await transporter.sendMail( choices). ).If you are actually not utilizing the server in nuxt, you can easily apply on any kind of framework for instance making use of reveal:.bring reveal from 'show'.bring in nodemailer coming from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi world',.html: layout,..wait for transporter.sendMail( choices).yield res.json( message: "Email sent out" ). ).app.listen( 3001 ).Information.Receive the full paperwork [listed below] ().Components.You can view the parts, listed below:.Combinations.E-mails developed with vue-email can be converted into HTML or even.plain text, as well as sent out using any email specialist. You may find.instances right here:.