Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced through react-email, it enables our team produce themes using the vue platform, along with components that assist our team create layouts effortlessly as well as swiftly.To begin utilizing vue-email in any type of vue project, you merely need to put in the plan:.Along with NPM:.$ npm mount vue-email.Along with Yarn:.$ anecdote add vue-email.Along with PNPM:.$ pnpm put up vue-email.Creating email template.Create a brand-new e-mail template in any place you desire to have your themes, for this situation, our experts may develop a theme folder, with a theme phoned welcome.vue.src/templates/welcome. vue.

label, welcome to vue-email.A Vue element library for building reactive emails.Viewpoint on GitHub.Pleased coding!David Arenas.
Rendering the layouts.Our company can easily use the make function, it gets pair of params, the 1st one is the design template to make, and also the 2nd the params to be used for the theme, and afterwards pass the end result theme in the physical body of request.Passing the design template in the physical body, give our team the opportunity of leaving utilizing any kind of server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email along with nodemailer.Placed e-mail.
Send email.In this instance i using nuxt v3 because it permits our company to set api inside own job, and also determine multiple api options.Listed here our company just extract the template of the request physical body, and send the email passing the template in the sendMail functionality of the nodemailer package.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const body system = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( bunch: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hey there planet',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are certainly not using the server in nuxt, you may easily carry out on any kind of structure as an example using share:.import show coming from 'share'.import nodemailer from 'nodemailer'.const app = reveal().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( bunch: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi world',.html: design template,..wait for transporter.sendMail( possibilities).yield res.json( notification: "Email sent" ). ).app.listen( 3001 ).Documents.Get the full information [below] ().Elements.You can find the components, listed below:.Integrations.Emails developed with vue-email could be converted into HTML or even.plain text, and also sent out utilizing any kind of e-mail specialist. You can view.examples listed below:.

Articles You Can Be Interested In