Sleep

Vue- Email - Vue.js Supplied

.Vue-email is influenced through react-email, it enables us develop layouts utilizing the vue structure, along with elements that help us develop templates easily and also quick.To begin making use of vue-email in any sort of vue job, you just need to install the package deal:.Along with NPM:.$ npm put in vue-email.With Yarn:.$ yarn add vue-email.With PNPM:.$ pnpm set up vue-email.Creating email layout.Generate a brand-new e-mail template in wherever you would like to have your layouts, for this case, our experts can produce a design template folder, with a theme phoned welcome.vue.src/templates/welcome. vue.

label, invited to vue-email.A Vue component library for building responsive emails.View on GitHub.Delighted coding!David Arenas.
Leaving the design templates.We may utilize the render functionality, it receives pair of params, the very first one is actually the design template to make, as well as the 2nd the params to be utilized for the layout, and after that pass the result theme in the physical body of demand.Passing the template in the body, provide our team the opportunity of making using any server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email along with nodemailer.Delivered e-mail.
Deliver email.In this example i utilizing nuxt v3 considering that it allows our company to prepare api inside own venture, as well as define a number of api courses.Listed here our experts merely draw out the design template of the ask for body system, and also send out the email passing the template in the sendMail function of the nodemailer bundle.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body = wait for readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( multitude: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello there world',.html: body.template,..await transporter.sendMail( options). ).If you are actually certainly not utilizing the web server in nuxt, you may easily implement on any type of structure for example using share:.import convey coming from 'reveal'.bring in nodemailer from 'nodemailer'.const application = show().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( host: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there planet',.html: theme,..await transporter.sendMail( choices).profit res.json( information: "Email sent" ). ).app.listen( 3001 ).Paperwork.Acquire the complete documentation [listed below] ().Elements.You can easily see the components, listed here:.Combinations.Emails built with vue-email may be converted into HTML or even.plain text, as well as sent using any type of email specialist. You may see.examples right here:.