Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually influenced by react-email, it permits us generate layouts using the vue platform, with elements that aid our team create themes easily as well as swiftly.To begin making use of vue-email in any vue task, you simply require to mount the package:.With NPM:.$ npm put in vue-email.With Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm set up vue-email.Producing email theme.Generate a brand new email design template in any place you desire to have your design templates, for this case, our team can easily produce a layout directory, along with a layout phoned welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue part library for property reactive emails.Scenery on GitHub.Satisfied coding!David Arenas.
Leaving the layouts.Our team can easily make use of the make functionality, it receives two params, the 1st one is the layout to make, as well as the 2nd the params to be used for the design template, and after that pass the result layout in the physical body of demand.Passing the theme in the physical body, give us the possibility of rendering making use of any kind of web server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver e-mail along with nodemailer.Routed email.
Deliver email.Within this instance i making use of nuxt v3 since it enables our team to set api inside personal project, as well as specify numerous api paths.Listed here our experts just draw out the design template of the demand physical body, and 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 system = wait for readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there planet',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are actually not making use of the hosting server in nuxt, you can conveniently carry out on any structure for instance utilizing convey:.import share from 'share'.bring in nodemailer from 'nodemailer'.const application = share().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',.slot: 587,.safe and secure: false,.auth: customer: testAccount.user,.elapsed: testAccount.pass,.,. ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi planet',.html: design template,..await transporter.sendMail( options).gain res.json( notification: "Email sent out" ). ).app.listen( 3001 ).Information.Receive the total records [right here] ().Components.You may find the elements, listed here:.Combinations.E-mails created with vue-email can be exchanged HTML or.clear text, as well as delivered using any kind of email specialist. You can easily find.examples right here:.