Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually inspired by react-email, it allows us develop design templates making use of the vue framework, along with components that help us develop themes conveniently and quickly.To start making use of vue-email in any vue venture, you simply need to have to put in the deal:.With NPM:.$ npm set up vue-email.Along with Yarn:.$ anecdote add vue-email.With PNPM:.$ pnpm put up vue-email.Developing e-mail template.Develop a brand new e-mail layout in wherever you intend to have your templates, for this situation, our company can create a theme folder, with a theme phoned welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue element library for building reactive e-mails.Scenery on GitHub.Delighted coding!David Arenas.
Providing the themes.Our experts may make use of the provide feature, it receives 2 params, the very first one is the layout to leave, and also the 2nd the params to be used for the layout, and afterwards pass the end result template in the physical body of ask for.Passing the template in the body, offer our team the chance of making making use of any sort of web server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver email with nodemailer.Delivered e-mail.
Send out email.In this instance i making use of nuxt v3 because it enables our company to establish api inside very own task, and also describe a number of api courses.Below our experts simply extract the design template of the ask for physical body, and send out the email passing the design template in the sendMail feature of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body system = await readBody( event).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings globe',.html: body.template,..wait for transporter.sendMail( choices). ).If you are actually not utilizing the web server in nuxt, you can conveniently apply on any framework for example utilizing share:.bring express coming from 'reveal'.bring in nodemailer from 'nodemailer'.const app = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( host: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there planet',.html: layout,..wait for transporter.sendMail( choices).yield res.json( message: "Email sent out" ). ).app.listen( 3001 ).Documentation.Get the complete information [here] ().Elements.You can easily observe the parts, listed below:.Combinations.Emails built along with vue-email could be converted into HTML or even.plain text, as well as sent out making use of any sort of email company. You can easily find.instances listed here:.

Articles You Can Be Interested In