Sleep

Vue- Email - Vue.js Supplied

.Vue-email is influenced through react-email, it allows us create templates using the vue framework, along with elements that help our company build design templates quickly as well as swiftly.To begin using vue-email in any type of vue project, you merely need to set up the package deal:.With NPM:.$ npm put in vue-email.With Yarn:.$ yarn incorporate vue-email.Along with PNPM:.$ pnpm put in vue-email.Developing e-mail template.Develop a brand new email theme in any place you desire to have your design templates, for this scenario, our experts can easily make a layout folder, along with a layout phoned welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue element library for structure responsive e-mails.View on GitHub.Satisfied coding!David Arenas.
Providing the design templates.Our team can easily use the make feature, it acquires pair of params, the 1st one is the template to provide, and the second the params to become used for the theme, and after that pass the end result layout in the body of request.Passing the theme in the physical body, provide our team the odds of providing making use of any type of server, express, fastify, nuxt in SSR, etc src/pages/index. vue.Send email along with nodemailer.Directed email.
Send out email.In this particular example i making use of nuxt v3 due to the fact that it allows us to establish api inside own job, and specify multiple api routes.Listed here our team only draw out the design template of the demand body system, and deliver the e-mail passing the template in the sendMail functionality of the nodemailer deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const body system = await readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings planet',.html: body.template,..wait for transporter.sendMail( choices). ).If you are not making use of the web server in nuxt, you may effortlessly execute on any kind of platform for example using convey:.import reveal from 'share'.import nodemailer coming from 'nodemailer'.const app = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.secure: incorrect,.auth: customer: testAccount.user,.successfully pass: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings world',.html: layout,..await transporter.sendMail( alternatives).profit res.json( message: "Email sent out" ). ).app.listen( 3001 ).Information.Get the complete information [right here] ().Components.You can easily view the parts, listed below:.Combinations.Emails created with vue-email could be exchanged HTML or.plain text, and also sent using any kind of e-mail provider. You can easily see.instances listed here:.

Articles You Can Be Interested In