Sleep

Vue- Email - Vue.js Supplied

.Vue-email is motivated by react-email, it permits us generate themes using the vue structure, along with elements that help our company create layouts effortlessly and swiftly.To start utilizing vue-email in any type of vue job, you just require to install the package deal:.Along with NPM:.$ npm install vue-email.With Yarn:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm mount vue-email.Making e-mail theme.Develop a brand new email layout in no matter where you desire to possess your layouts, for this scenario, we can produce a theme file, with a template phoned welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue component public library for structure responsive e-mails.Sight on GitHub.Delighted coding!David Arenas.
Leaving the themes.Our team can make use of the leave functionality, it acquires two params, the initial one is actually the design template to make, and the second the params to be made use of for the design template, and then pass the outcome design template in the body of ask for.Passing the design template in the physical body, provide our company the possibility of providing making use of any type of server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out e-mail with nodemailer.Placed e-mail.
Send email.Within this example i utilizing nuxt v3 given that it permits us to specify api inside personal job, as well as describe several api courses.Here our team merely remove the layout of the request physical body, and send the email passing the layout in the sendMail feature of the nodemailer package.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const physical body = await readBody( celebration).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.secure: misleading,.auth: user: testAccount.user,.successfully pass: testAccount.pass,.,. ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there globe',.html: body.template,..await transporter.sendMail( choices). ).If you are actually not using the web server in nuxt, you can easily carry out on any structure for instance making use of share:.bring reveal coming from 'share'.import nodemailer from 'nodemailer'.const app = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there globe',.html: template,..wait for transporter.sendMail( possibilities).return res.json( notification: "Email sent" ). ).app.listen( 3001 ).Documentation.Obtain the total paperwork [listed below] ().Elements.You can easily see the components, listed below:.Integrations.Emails created along with vue-email may be converted into HTML or.clear text, and sent out using any type of e-mail service provider. You may find.instances listed here:.