Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually encouraged by react-email, it permits our team make design templates utilizing the vue structure, with components that assist our team create themes effortlessly and also quickly.To start utilizing vue-email in any type of vue project, you simply need to have to put in the package:.With NPM:.$ npm install vue-email.Along with Anecdote:.$ anecdote include vue-email.With PNPM:.$ pnpm put up vue-email.Producing e-mail layout.Make a brand new e-mail template in anywhere you want to possess your themes, for this case, our company can generate a template directory, with a template contacted welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue element library for property reactive emails.View on GitHub.Delighted coding!David Arenas.
Rendering the layouts.Our team may utilize the make feature, it obtains pair of params, the initial one is actually the layout to leave, and also the second the params to be utilized for the template, and afterwards pass the end result template in the body of demand.Passing the template in the physical body, provide our company the possibility of making utilizing any kind of hosting server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Shipped email.
Send out email.In this example i using nuxt v3 given that it allows us to set api inside personal venture, and describe a number of api options.Right here our experts just remove the layout of the ask for body, and also send the email passing the theme in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const body = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.secure: incorrect,.auth: user: testAccount.user,.successfully pass: testAccount.pass,.,. ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there globe',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually not making use of the hosting server in nuxt, you can simply execute on any sort of platform for example utilizing reveal:.bring convey coming from 'convey'.bring in nodemailer coming from 'nodemailer'.const app = reveal().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( lot: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello there planet',.html: theme,..await transporter.sendMail( alternatives).return res.json( message: "Email sent" ). ).app.listen( 3001 ).Information.Obtain the complete documents [right here] ().Elements.You may see the components, listed here:.Integrations.E-mails built with vue-email could be converted into HTML or.clear text, as well as sent out making use of any sort of e-mail service provider. You can see.examples listed here:.