Sleep

Vue- Email - Vue.js Supplied

.Vue-email is encouraged by react-email, it allows our company generate layouts using the vue framework, along with elements that help our company build design templates easily and also quickly.To start making use of vue-email in any type of vue project, you simply need to put up the package:.Along with NPM:.$ npm put in vue-email.Along with Yarn:.$ yarn add vue-email.With PNPM:.$ pnpm set up vue-email.Producing email design template.Create a new e-mail layout in wherever you intend to possess your design templates, for this scenario, we can produce a template folder, along with a layout phoned welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component public library for building receptive e-mails.Scenery on GitHub.Happy coding!David Arenas.
Providing the templates.Our experts may use the provide functionality, it obtains 2 params, the first one is the theme to render, as well as the second the params to become made use of for the theme, and after that pass the result theme in the physical body of demand.Passing the template in the body, give us the odds of making making use of any type of hosting server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email with nodemailer.Placed e-mail.
Send out email.In this instance i using nuxt v3 since it permits our team to establish api inside very own venture, and describe various api paths.Right here our experts simply draw out the design template of the demand body, and also deliver the email passing the design template in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const physical body = wait for readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.safe: false,.auth: individual: testAccount.user,.successfully pass: testAccount.pass,.,. ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello there globe',.html: body.template,..await transporter.sendMail( choices). ).If you are actually certainly not making use of the hosting server in nuxt, you can simply implement on any platform as an example utilizing express:.import share from 'show'.bring in nodemailer coming from 'nodemailer'.const application = 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( 'smtp.ethereal.email',.port: 587,.safe and secure: untrue,.auth: customer: testAccount.user,.successfully pass: testAccount.pass,.,. ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there globe',.html: theme,..wait for transporter.sendMail( options).profit res.json( message: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Acquire the complete records [listed here] ().Elements.You may observe the elements, listed below:.Integrations.Emails constructed along with vue-email may be exchanged HTML or.clear text, as well as delivered using any type of email specialist. You may observe.instances listed here:.