Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually encouraged by react-email, it enables our company generate design templates utilizing the vue framework, with components that assist our team develop templates quickly and quickly.To start using vue-email in any kind of vue job, you simply require to put in the package deal:.With NPM:.$ npm set up vue-email.Along with Yarn:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm put up vue-email.Making e-mail theme.Create a new e-mail design template in wherever you would like to have your templates, for this situation, our experts can develop a layout directory, with a theme contacted welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue element collection for structure reactive emails.Scenery on GitHub.Delighted coding!David Arenas.
Leaving the themes.We can easily utilize the provide function, it gets pair of params, the 1st one is actually the theme to render, as well as the 2nd the params to be used for the layout, and after that pass the outcome design template in the body system of request.Passing the layout in the body, provide our team the chance of providing using any server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email along with nodemailer.Emailed e-mail.
Send out email.In this example i making use of nuxt v3 due to the fact that it allows our team to set api inside very own project, and determine a number of api options.Listed below we simply extract the template of the ask for physical body, and also send out the email passing the theme in the sendMail feature of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const body = wait for readBody( celebration).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( bunch: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hello world',.html: body.template,..await transporter.sendMail( options). ).If you are certainly not using the server in nuxt, you may quickly implement on any type of platform for example making use of convey:.bring express from 'share'.bring in nodemailer coming from 'nodemailer'.const application = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( lot: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi there world',.html: template,..await transporter.sendMail( options).profit res.json( information: "Email sent" ). ).app.listen( 3001 ).Information.Acquire the total information [here] ().Parts.You can easily find the parts, listed here:.Integrations.Emails built with vue-email could be exchanged HTML or.plain text, and also sent out making use of any sort of email provider. You can easily view.instances right here:.