Sleep

Vue- Email - Vue.js Feed

.Vue-email is influenced by react-email, it enables us make themes using the vue platform, along with components that assist our team develop templates conveniently and quickly.To start making use of vue-email in any vue project, you simply need to put in the package deal:.Along with NPM:.$ npm put up vue-email.Along with Yarn:.$ anecdote include vue-email.With PNPM:.$ pnpm set up vue-email.Creating e-mail layout.Develop a brand-new email template in anywhere you wish to have your themes, for this case, our company can create a theme file, with a template contacted welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue part collection for building responsive e-mails.Perspective on GitHub.Satisfied coding!David Arenas.
Providing the themes.Our team can make use of the render feature, it gets 2 params, the 1st one is actually the design template to provide, as well as the 2nd the params to be utilized for the theme, and then pass the outcome template in the body of demand.Passing the template in the body system, give us the possibility of leaving using any server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Dispatched e-mail.
Deliver email.In this particular example i making use of nuxt v3 since it permits our company to set api inside personal venture, as well as specify multiple api courses.Listed here our team just remove the template of the request physical body, as well as send the email passing the theme in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const body system = await readBody( event).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there planet',.html: body.template,..await transporter.sendMail( options). ).If you are actually not making use of the server in nuxt, you can effortlessly carry out on any type of platform for example making use of convey:.import express from 'show'.bring in nodemailer coming from 'nodemailer'.const application = show().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there planet',.html: theme,..wait for transporter.sendMail( possibilities).yield res.json( information: "Email sent" ). ).app.listen( 3001 ).Records.Obtain the complete information [right here] ().Parts.You can easily view the elements, listed here:.Assimilations.E-mails created along with vue-email could be converted into HTML or.plain text, as well as sent utilizing any type of e-mail specialist. You may find.instances here:.