Sleep

Vue- Email - Vue.js Feed

.Vue-email is encouraged by react-email, it enables us develop templates using the vue structure, with parts that assist us create design templates effortlessly and also fast.To begin using vue-email in any sort of vue job, you only need to have to mount the bundle:.Along with NPM:.$ npm set up vue-email.Along with Yarn:.$ yarn add vue-email.With PNPM:.$ pnpm mount vue-email.Making email theme.Produce a brand-new email design template in wherever you wish to have your templates, for this instance, our company can easily develop a template folder, along with a design template called welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue part library for property receptive e-mails.Perspective on GitHub.Pleased coding!David Arenas.
Rendering the themes.Our team can utilize the leave functionality, it acquires two params, the first one is the theme to provide, and also the second the params to be utilized for the layout, and afterwards pass the outcome design template in the body system of ask for.Passing the theme in the physical body, give our company the odds of rendering using any sort of web server, show, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email along with nodemailer.Directed email.
Send email.In this instance i utilizing nuxt v3 given that it allows us to establish api inside very own task, and also specify numerous api options.Listed here our team simply draw out the template of the ask for physical body, and also send out the e-mail passing the template in the sendMail feature of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body = await readBody( occasion).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( multitude: process.env.HOST ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hello globe',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are certainly not making use of the hosting server in nuxt, you can quickly implement on any type of framework for example making use of reveal:.import share coming from 'show'.bring in nodemailer coming 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 = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.secure: incorrect,.auth: customer: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there planet',.html: template,..await transporter.sendMail( choices).return res.json( message: "Email delivered" ). ).app.listen( 3001 ).Information.Obtain the full records [here] ().Elements.You can view the parts, listed below:.Integrations.Emails developed along with vue-email may be converted into HTML or even.clear text, and also delivered making use of any sort of email company. You can see.examples here:.