Sleep

Vue- Email - Vue.js Supplied

.Vue-email is encouraged through react-email, it permits our company produce design templates making use of the vue framework, along with parts that assist our team create design templates effortlessly and also swiftly.To begin making use of vue-email in any sort of vue task, you simply require to put in the package:.Along with NPM:.$ npm set up vue-email.Along with Yarn:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm install vue-email.Developing email layout.Create a new e-mail template in anywhere you intend to possess your themes, for this situation, our team can easily develop a theme file, along with a design template phoned welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue component public library for property receptive emails.Viewpoint on GitHub.Satisfied coding!David Arenas.
Leaving the themes.Our company can easily use the leave functionality, it obtains two params, the initial one is actually the theme to render, and also the 2nd the params to become made use of for the design template, and then pass the outcome layout in the body of ask for.Passing the template in the physical body, offer our company the opportunity of leaving using any kind of server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send e-mail along with nodemailer.Placed email.
Send email.Within this example i using nuxt v3 because it permits our company to set api inside very own venture, as well as describe a number of api routes.Listed here our experts merely draw out the design template of the request physical body, and also send out the e-mail passing the theme in the sendMail feature of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const body = wait for readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there world',.html: body.template,..wait for transporter.sendMail( options). ).If you are certainly not making use of the hosting server in nuxt, you may easily implement on any kind of platform for example utilizing express:.bring reveal coming from 'convey'.import nodemailer from 'nodemailer'.const application = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe and secure: misleading,.auth: consumer: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there world',.html: layout,..wait for transporter.sendMail( alternatives).return res.json( information: "Email sent out" ). ).app.listen( 3001 ).Information.Receive the complete documentation [listed below] ().Parts.You may find the components, listed below:.Assimilations.E-mails developed with vue-email could be converted into HTML or.clear text, and sent out using any e-mail service provider. You may see.instances here:.

Articles You Can Be Interested In