Sleep

Vue- Email - Vue.js Feed

.Vue-email is inspired through react-email, it enables our company generate templates making use of the vue framework, with parts that help our team develop design templates conveniently and swiftly.To start making use of vue-email in any vue venture, you simply need to put up the deal:.Along with NPM:.$ npm mount vue-email.Along with Yarn:.$ anecdote incorporate vue-email.With PNPM:.$ pnpm mount vue-email.Creating e-mail theme.Generate a new e-mail design template in anywhere you want to have your layouts, for this case, our experts can create a theme folder, along with a template contacted welcome.vue.src/templates/welcome. vue.

title, welcome to vue-email.A Vue element library for building receptive e-mails.Sight on GitHub.Happy coding!David Arenas.
Making the design templates.Our experts may make use of the render feature, it obtains pair of params, the initial one is the design template to provide, as well as the second the params to become utilized for the template, and after that pass the result layout in the body of ask for.Passing the design template in the body system, provide our team the odds of rendering using any type of hosting server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email with nodemailer.Delivered e-mail.
Deliver e-mail.Within this instance i making use of nuxt v3 given that it enables our company to prepare api inside own project, as well as define several api options.Here we simply extract the layout of the ask for body, and send the email passing the layout in the sendMail functionality 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( occasion).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.protected: misleading,.auth: individual: testAccount.user,.elapsed: testAccount.pass,.,. ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there world',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are certainly not making use of the hosting server in nuxt, you can quickly implement on any structure for instance utilizing express:.import share from 'reveal'.import nodemailer coming from 'nodemailer'.const application = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there planet',.html: design template,..wait for transporter.sendMail( alternatives).profit res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Records.Acquire the full information [below] ().Components.You can find the parts, listed below:.Combinations.E-mails constructed along with vue-email could be exchanged HTML or even.clear text, as well as delivered making use of any type of email company. You can easily find.examples here:.