Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually inspired by react-email, it allows us make layouts using the vue platform, with components that aid our team build layouts conveniently and also quickly.To begin making use of vue-email in any type of vue job, you just need to have to mount the plan:.Along with NPM:.$ npm put up vue-email.With Anecdote:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm put up vue-email.Developing e-mail theme.Produce a brand-new e-mail theme in wherever you want to have your themes, for this situation, our company may develop a layout folder, with a theme gotten in touch with welcome.vue.src/templates/welcome. vue.

label, welcome to vue-email.A Vue part library for building receptive e-mails.Scenery on GitHub.Pleased coding!David Arenas.
Leaving the themes.Our company may use the make feature, it obtains two params, the 1st one is actually the layout to render, and the 2nd the params to be made use of for the theme, and after that pass the result design template in the body of request.Passing the layout in the body system, give us the opportunity of rendering making use of any sort of web server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Send email with nodemailer.Provided email.
Send out e-mail.In this particular instance i making use of nuxt v3 considering that it permits us to prepare api inside own venture, and specify various api routes.Listed here our team just draw out the template of the ask for physical body, and also send the email passing the layout in the sendMail functionality of the nodemailer package deal.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const body = wait for readBody( celebration).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( host: process.env.HOST ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hello globe',.html: body.template,..await transporter.sendMail( choices). ).If you are not utilizing the server in nuxt, you can easily carry out on any kind of framework as an example utilizing show:.import show coming from 'reveal'.bring in nodemailer from 'nodemailer'.const application = show().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( host: process.env.HOST ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hi planet',.html: template,..wait for transporter.sendMail( choices).yield res.json( message: "Email sent out" ). ).app.listen( 3001 ).Paperwork.Get the complete paperwork [right here] ().Elements.You can see the components, listed below:.Integrations.E-mails constructed with vue-email may be converted into HTML or.plain text, as well as sent out utilizing any type of e-mail service provider. You may see.examples below:.