Sleep

Vue- Email - Vue.js Nourished

.Vue-email is encouraged through react-email, it enables us create templates utilizing the vue platform, with parts that assist our company build themes conveniently and also swiftly.To begin utilizing vue-email in any sort of vue project, you merely need to have to install the bundle:.Along with NPM:.$ npm install vue-email.Along with Yarn:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm install vue-email.Developing e-mail design template.Make a new e-mail design template in no matter where you desire to have your design templates, for this instance, our team may develop a layout file, with a template gotten in touch with welcome.vue.src/templates/welcome. vue.

label, appreciated to vue-email.A Vue component collection for building reactive emails.Viewpoint on GitHub.Delighted coding!David Arenas.
Making the layouts.Our experts can easily use the render feature, it acquires pair of params, the very first one is the layout to leave, and also the 2nd the params to be used for the theme, and then pass the result theme in the body system of ask for.Passing the design template in the body system, provide our team the possibility of providing using any server, reveal, fastify, nuxt in SSR, and so on src/pages/index. vue.Send email with nodemailer.Shipped e-mail.
Send out e-mail.In this particular instance i utilizing nuxt v3 due to the fact that it enables us to prepare api inside personal project, as well as determine various api paths.Listed here our experts merely extract the theme of the ask for body system, and also deliver the email passing the layout in the sendMail functionality of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there world',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are not using the hosting server in nuxt, you may effortlessly carry out on any kind of framework for example using convey:.import convey from 'reveal'.import nodemailer from 'nodemailer'.const app = 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( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello there globe',.html: theme,..wait for transporter.sendMail( options).yield res.json( notification: "Email sent out" ). ).app.listen( 3001 ).Documentation.Receive the full documents [here] ().Parts.You can view the elements, listed here:.Assimilations.Emails constructed with vue-email may be converted into HTML or even.clear text, and also delivered making use of any email service provider. You can view.examples below:.