Sleep

Vue- Email - Vue.js Feed

.Vue-email is motivated by react-email, it enables our company develop themes utilizing the vue platform, with components that assist our team develop layouts quickly and quickly.To start using vue-email in any sort of vue project, you only need to have to set up the package deal:.With NPM:.$ npm put up vue-email.With Yarn:.$ anecdote add vue-email.With PNPM:.$ pnpm install vue-email.Producing e-mail theme.Produce a brand new email theme in anywhere you would like to have your design templates, for this case, our team can generate a theme folder, with a design template contacted welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue element library for property reactive emails.Perspective on GitHub.Pleased coding!David Arenas.
Rendering the design templates.Our company may use the leave functionality, it obtains 2 params, the initial one is actually the design template to make, and the second the params to be made use of for the template, and after that pass the end result template in the physical body of demand.Passing the theme in the physical body, offer our company the chance of rendering using any sort of web server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Send e-mail with nodemailer.Sent e-mail.
Deliver e-mail.In this particular example i using nuxt v3 since it permits us to prepare api inside personal task, as well as specify several api paths.Listed here we merely remove the layout of the ask for physical body, as well as send the email passing the design template in the sendMail functionality of the nodemailer package.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const body system = wait for readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( host: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello world',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually certainly not using the hosting server in nuxt, you may simply apply on any platform for instance using share:.bring show coming from 'convey'.bring in nodemailer from 'nodemailer'.const app = reveal().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( multitude: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there globe',.html: design template,..await transporter.sendMail( possibilities).gain res.json( message: "Email sent out" ). ).app.listen( 3001 ).Information.Acquire the total documentation [listed below] ().Elements.You can easily find the parts, listed below:.Integrations.Emails developed along with vue-email can be converted into HTML or.clear text, and also delivered making use of any type of email service provider. You can view.instances listed here:.