Sleep

Vue- Email - Vue.js Nourished

.Vue-email is encouraged through react-email, it allows our team create templates utilizing the vue framework, along with components that help our company develop templates quickly as well as fast.To begin making use of vue-email in any kind of vue project, you simply need to set up the deal:.Along with NPM:.$ npm install vue-email.Along with Anecdote:.$ anecdote include vue-email.With PNPM:.$ pnpm mount vue-email.Developing e-mail design template.Produce a new e-mail template in anywhere you intend to possess your layouts, for this situation, our team can easily produce a theme directory, along with a template contacted welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue element library for property receptive emails.Scenery on GitHub.Delighted coding!David Arenas.
Rendering the themes.Our experts can easily use the provide functionality, it obtains two params, the initial one is actually the design template to render, as well as the second the params to become utilized for the template, and after that pass the outcome template in the body of demand.Passing the template in the physical body, give our team the possibility of providing utilizing any kind of server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver e-mail with nodemailer.Mailed email.
Deliver email.Within this example i using nuxt v3 because it permits our team to specify api inside personal job, and also determine several api options.Right here our company only extract the design template of the demand physical body, as well as send out the email passing the layout in the sendMail function of the nodemailer package.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const physical body = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.safe: inaccurate,.auth: individual: testAccount.user,.successfully pass: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there planet',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually certainly not utilizing the hosting server in nuxt, you can effortlessly execute on any kind of structure for example making use of reveal:.import share coming from 'show'.bring in nodemailer coming from 'nodemailer'.const app = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( multitude: process.env.HOST ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi there planet',.html: template,..wait for transporter.sendMail( choices).profit res.json( message: "Email sent out" ). ).app.listen( 3001 ).Documents.Get the total records [below] ().Components.You may observe the components, listed below:.Integrations.Emails built with vue-email can be exchanged HTML or even.plain text, and sent utilizing any type of email provider. You can easily observe.examples here:.