Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually influenced through react-email, it permits our team generate templates utilizing the vue framework, along with parts that aid our team construct templates effortlessly and also swiftly.To begin utilizing vue-email in any vue task, you only require to put up the package deal:.Along with NPM:.$ npm put up vue-email.With Yarn:.$ anecdote incorporate vue-email.With PNPM:.$ pnpm install vue-email.Generating e-mail template.Generate a new email layout in everywhere you wish to possess your layouts, for this case, our team can produce a layout file, with a design template contacted welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component public library for property receptive emails.Viewpoint on GitHub.Happy coding!David Arenas.
Providing the templates.Our company can easily use the make function, it gets 2 params, the very first one is the design template to render, and also the 2nd the params to be utilized for the template, and then pass the outcome layout in the body system of request.Passing the template in the body system, give our company the odds of leaving making use of any type of hosting server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out email along with nodemailer.Provided e-mail.
Send out e-mail.In this instance i utilizing nuxt v3 considering that it permits our team to prepare api inside own job, and also define a number of api routes.Listed below our company merely draw out the theme of the ask for body system, and also send the email passing the theme in the sendMail function of the nodemailer bundle.src/server/api/ email.post.ts.import nodemailer from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body = await readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( multitude: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hi there world',.html: body.template,..await transporter.sendMail( choices). ).If you are certainly not making use of the web server in nuxt, you may simply carry out on any sort of framework for instance utilizing express:.bring reveal coming from 'share'.bring in nodemailer coming from 'nodemailer'.const app = show().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.protected: incorrect,.auth: user: testAccount.user,.successfully pass: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings planet',.html: design template,..await transporter.sendMail( choices).gain res.json( message: "Email sent" ). ).app.listen( 3001 ).Paperwork.Get the total information [right here] ().Components.You can see the elements, listed here:.Integrations.E-mails constructed with vue-email could be exchanged HTML or.plain text, and sent using any type of e-mail company. You may view.examples listed below:.