Sleep

Vue- Email - Vue.js Nourished

.Vue-email is inspired by react-email, it enables our company produce themes making use of the vue framework, with elements that help our team develop themes quickly and also fast.To begin making use of vue-email in any type of vue job, you just need to have to mount the deal:.With NPM:.$ npm put up vue-email.With Anecdote:.$ yarn add vue-email.Along with PNPM:.$ pnpm install vue-email.Creating e-mail template.Produce a brand new e-mail template in wherever you would like to have your themes, for this instance, our team can easily generate a template folder, along with a theme contacted welcome.vue.src/templates/welcome. vue.

label, invited to vue-email.A Vue part library for property receptive e-mails.Perspective on GitHub.Pleased coding!David Arenas.
Leaving the layouts.Our company can use the render functionality, it receives two params, the 1st one is the theme to leave, as well as the 2nd the params to become utilized for the template, and after that pass the end result layout in the body system of request.Passing the design template in the body, provide our team the opportunity of providing using any sort of hosting server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Provided e-mail.
Send e-mail.In this particular example i making use of nuxt v3 given that it enables us to prepare api inside personal project, and also define multiple api paths.Right here our company simply extract the layout of the demand body system, and also send the e-mail passing the theme in the sendMail feature of the nodemailer deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body = wait for readBody( event).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there globe',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are certainly not making use of the server in nuxt, you can quickly apply on any type of structure as an example utilizing reveal:.bring show from 'show'.bring in nodemailer from 'nodemailer'.const application = show().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 carrier = nodemailer.createTransport( bunch: process.env.HOST ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there planet',.html: template,..await transporter.sendMail( possibilities).profit res.json( message: "Email sent out" ). ).app.listen( 3001 ).Paperwork.Get the full paperwork [below] ().Elements.You may observe the parts, listed below:.Integrations.Emails constructed along with vue-email could be converted into HTML or.clear text, and also delivered utilizing any sort of email company. You can easily view.instances listed here:.