.Vue-email is actually motivated by react-email, it allows us generate themes making use of the vue platform, along with components that aid us construct themes easily as well as quickly.To start making use of vue-email in any type of vue task, you merely need to have to put up the deal:.With NPM:.$ npm set up vue-email.Along with Anecdote:.$ anecdote include vue-email.With PNPM:.$ pnpm put in vue-email.Developing email template.Develop a brand-new e-mail design template in no matter where you wish to have your themes, for this case, our team can easily generate a layout folder, along with a template gotten in touch with welcome.vue.src/templates/welcome. vue.
label, invited to vue-email.A Vue element library for property reactive emails.View on GitHub.Happy coding!David Arenas.
Rendering the layouts.Our experts can use the provide functionality, it obtains pair of params, the first one is the template to make, and the second the params to become utilized for the design template, and after that pass the result theme in the body of demand.Passing the layout in the body, give our team the opportunity of providing using any server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send email along with nodemailer.Placed e-mail.
Deliver e-mail.In this particular example i utilizing nuxt v3 considering that it enables our company to establish api inside own venture, and specify a number of api courses.Right here our experts just extract the theme of the ask for physical body, and also send out the email passing the theme in the sendMail functionality of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) => const physical body = await readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.safe and secure: untrue,.auth: user: testAccount.user,.pass: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there world',.html: body.template,..await transporter.sendMail( possibilities). ).If you are certainly not using the hosting server in nuxt, you may effortlessly carry out on any structure for instance utilizing reveal:.bring reveal coming from 'convey'.import nodemailer from 'nodemailer'.const application = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) => const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.protected: untrue,.auth: individual: testAccount.user,.elapsed: testAccount.pass,.,. ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there globe',.html: design template,..wait for transporter.sendMail( choices).profit res.json( message: "Email sent out" ). ).app.listen( 3001 ).Paperwork.Receive the total records [here] ().Elements.You can view the components, listed below:.Combinations.Emails created with vue-email may be converted into HTML or.plain text, as well as sent making use of any sort of email provider. You can find.instances listed below:.