Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually encouraged through react-email, it enables our team create themes utilizing the vue structure, along with components that help us create design templates quickly as well as quick.To start utilizing vue-email in any type of vue task, you simply need to have to set up the package deal:.With NPM:.$ npm mount vue-email.Along with Anecdote:.$ yarn include vue-email.Along with PNPM:.$ pnpm mount vue-email.Making e-mail layout.Create a brand new email template in wherever you desire to have your templates, for this scenario, our experts can easily develop a layout file, along with a theme phoned welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component collection for property responsive e-mails.Viewpoint on GitHub.Pleased coding!David Arenas.
Making the templates.Our experts can easily utilize the leave feature, it receives two params, the first one is actually the template to leave, as well as the 2nd the params to be used for the layout, and after that pass the outcome theme in the body system of request.Passing the design template in the physical body, provide our team the chance of rendering making use of any type of web server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Send email with nodemailer.Provided e-mail.
Send e-mail.Within this instance i utilizing nuxt v3 considering that it allows our company to set api inside own venture, as well as define multiple api routes.Right here our team merely remove the design template of the demand body, and deliver the e-mail passing the theme in the sendMail functionality of the nodemailer deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const body system = wait for readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi there world',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are actually not using the web server in nuxt, you can simply implement on any type of structure for instance utilizing convey:.import express coming from 'convey'.bring in nodemailer from 'nodemailer'.const application = express().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( ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello planet',.html: template,..await transporter.sendMail( choices).profit res.json( message: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Get the full documents [listed here] ().Components.You may find the parts, listed here:.Integrations.Emails created with vue-email could be exchanged HTML or even.clear text, as well as delivered using any type of e-mail company. You may observe.instances here:.