Sleep

Vue- Email - Vue.js Feed

.Vue-email is motivated by react-email, it permits our company generate themes utilizing the vue structure, with parts that assist us create themes easily as well as fast.To begin utilizing vue-email in any sort of vue job, you only need to put in the package:.With NPM:.$ npm put up vue-email.Along with Anecdote:.$ anecdote include vue-email.With PNPM:.$ pnpm put up vue-email.Creating email template.Develop a brand new email template in everywhere you would like to possess your design templates, for this situation, our team can easily create a layout folder, along with a template phoned welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue element public library for property responsive emails.Sight on GitHub.Pleased coding!David Arenas.
Making the templates.We can use the provide function, it acquires pair of params, the first one is actually the template to provide, as well as the 2nd the params to be used for the design template, and after that pass the outcome design template in the body system of ask for.Passing the template in the body, provide us the opportunity of providing utilizing any hosting server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Send e-mail along with nodemailer.Posted email.
Deliver e-mail.In this particular instance i utilizing nuxt v3 given that it allows us to specify api inside very own job, as well as specify several api paths.Listed below our company only draw out the theme of the request body, and deliver the email passing the theme in the sendMail feature of the nodemailer bundle.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const physical body = await readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hey there world',.html: body.template,..wait for transporter.sendMail( possibilities). ).If you are actually not using the server in nuxt, you may conveniently implement on any kind of structure for instance making use of show:.import share from 'show'.import nodemailer from 'nodemailer'.const application = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello world',.html: layout,..await transporter.sendMail( possibilities).gain res.json( message: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Obtain the complete documents [listed below] ().Elements.You can easily view the components, listed below:.Integrations.Emails developed along with vue-email can be converted into HTML or even.clear text, and sent out utilizing any kind of e-mail specialist. You can observe.examples here:.

Articles You Can Be Interested In