Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually influenced through react-email, it allows our team develop themes using the vue structure, with components that help us develop templates easily as well as fast.To begin making use of vue-email in any kind of vue task, you just need to have to put in the package deal:.With NPM:.$ npm mount vue-email.With Yarn:.$ anecdote incorporate vue-email.With PNPM:.$ pnpm install vue-email.Making e-mail template.Develop a new e-mail design template in anywhere you intend to possess your themes, for this situation, our company can easily generate a layout folder, along with a layout phoned welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component collection for building receptive emails.Scenery on GitHub.Satisfied coding!David Arenas.
Providing the templates.Our company may utilize the make function, it gets pair of params, the initial one is actually the design template to render, and the second the params to be used for the design template, and after that pass the outcome template in the body of demand.Passing the theme in the body system, offer our team the possibility of providing using any type of server, reveal, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Routed email.
Deliver email.In this example i using nuxt v3 considering that it permits our team to prepare api inside personal project, and also describe several api routes.Below our team simply remove the template of the demand body system, as well as send out the email passing the template in the sendMail feature of the nodemailer deal.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (occasion) =&gt const body system = await readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there globe',.html: body.template,..wait for transporter.sendMail( choices). ).If you are actually certainly not using the server in nuxt, you can simply apply on any structure as an example making use of show:.bring reveal coming from 'reveal'.import nodemailer from 'nodemailer'.const application = express().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello there planet',.html: template,..wait for transporter.sendMail( options).return res.json( notification: "Email sent" ). ).app.listen( 3001 ).Information.Obtain the total paperwork [below] ().Components.You can find the components, listed here:.Integrations.E-mails constructed along with vue-email may be exchanged HTML or.clear text, and sent utilizing any sort of e-mail service provider. You can see.instances right here:.