Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually motivated through react-email, it enables our company create design templates making use of the vue framework, along with elements that assist us build design templates easily and also fast.To begin making use of vue-email in any type of vue project, you merely require to set up the package deal:.Along with NPM:.$ npm set up vue-email.Along with Anecdote:.$ anecdote include vue-email.Along with PNPM:.$ pnpm install vue-email.Generating email layout.Create a brand new e-mail design template in anywhere you would like to possess your design templates, for this instance, we may produce a theme file, along with a layout called welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue part public library for property reactive e-mails.Scenery on GitHub.Happy coding!David Arenas.
Making the themes.Our experts can easily make use of the provide functionality, it obtains two params, the first one is the template to leave, and the 2nd the params to become used for the design template, and then pass the outcome theme in the body of ask for.Passing the design template in the body, offer our team the chance of providing making use of any kind of server, share, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver e-mail with nodemailer.Dispatched email.
Send out email.Within this example i utilizing nuxt v3 due to the fact that it permits our company to specify api inside personal venture, and specify a number of api options.Right here our company merely remove the template of the demand body, as well as deliver the email passing the template in the sendMail feature of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const body = wait for readBody( event).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello globe',.html: body.template,..await transporter.sendMail( choices). ).If you are actually certainly not using the web server in nuxt, you can quickly execute on any kind of framework as an example making use of express:.bring share coming from 'share'.bring in nodemailer from 'nodemailer'.const app = reveal().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( 'smtp.ethereal.email',.slot: 587,.secure: untrue,.auth: consumer: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there world',.html: template,..wait for transporter.sendMail( alternatives).profit res.json( message: "Email sent out" ). ).app.listen( 3001 ).Documents.Receive the full documentation [listed here] ().Elements.You can observe the components, listed here:.Integrations.E-mails created along with vue-email could be converted into HTML or.clear text, as well as delivered utilizing any email provider. You may observe.instances here:.

Articles You Can Be Interested In