Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually influenced through react-email, it permits our company create layouts using the vue framework, along with elements that aid our team develop templates quickly as well as fast.To start using vue-email in any kind of vue venture, you simply require to put in the bundle:.Along with NPM:.$ npm put in vue-email.Along with Anecdote:.$ yarn incorporate vue-email.With PNPM:.$ pnpm install vue-email.Creating email template.Generate a brand-new e-mail theme in no matter where you would like to possess your design templates, for this scenario, our experts can easily create a theme folder, with a theme gotten in touch with welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue part public library for building responsive e-mails.Viewpoint on GitHub.Satisfied coding!David Arenas.
Providing the templates.We can use the render feature, it obtains 2 params, the very first one is the design template to provide, and also the 2nd the params to become utilized for the design template, and then pass the outcome template in the physical body of request.Passing the layout in the body, give us the possibility of rendering utilizing any sort of hosting server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email along with nodemailer.Routed email.
Send email.In this particular example i utilizing nuxt v3 since it allows our company to prepare api inside personal task, as well as describe several api routes.Below our team only remove the layout of the ask for physical body, and send the e-mail passing the template in the sendMail function of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const physical body = await readBody( celebration).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.protected: untrue,.auth: consumer: testAccount.user,.pass: testAccount.pass,.,. ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hello world',.html: body.template,..await transporter.sendMail( possibilities). ).If you are certainly not making use of the server in nuxt, you can easily apply on any structure as an example making use of show:.bring share coming from 'share'.import nodemailer from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe: untrue,.auth: consumer: testAccount.user,.successfully pass: testAccount.pass,.,. ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there globe',.html: template,..await transporter.sendMail( alternatives).return res.json( information: "Email sent out" ). ).app.listen( 3001 ).Records.Acquire the complete documentation [right here] ().Parts.You may see the components, listed here:.Integrations.E-mails constructed with vue-email could be converted into HTML or.plain text, and also sent utilizing any sort of email provider. You may observe.instances here:.