Sleep

Vue- Email - Vue.js Supplied

.Vue-email is influenced by react-email, it enables our company generate themes making use of the vue platform, with elements that assist our team develop design templates conveniently as well as quickly.To start utilizing vue-email in any sort of vue task, you merely need to put in the deal:.Along with NPM:.$ npm put in vue-email.Along with Yarn:.$ anecdote add vue-email.With PNPM:.$ pnpm mount vue-email.Making email design template.Develop a brand new email theme in any place you wish to possess your layouts, for this scenario, our company can easily develop a theme file, along with a template called welcome.vue.src/templates/welcome. vue.

label, welcome to vue-email.A Vue element public library for structure reactive emails.Scenery on GitHub.Satisfied coding!David Arenas.
Rendering the themes.Our company can easily utilize the provide feature, it acquires pair of params, the initial one is actually the design template to render, and the 2nd the params to become utilized for the theme, and after that pass the end result layout in the body system of demand.Passing the layout in the body, offer us the opportunity of rendering making use of any kind of hosting server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver email along with nodemailer.Sent email.
Deliver e-mail.Within this instance i using nuxt v3 since it enables us to specify api inside very own task, and also describe several api paths.Listed here our experts merely remove the design template of the demand body, and also send out the e-mail passing the theme in the sendMail function of the nodemailer bundle.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const body = await readBody( activity).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.secure: untrue,.auth: customer: testAccount.user,.elapsed: testAccount.pass,.,. ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.target: 'greetings globe',.html: body.template,..await transporter.sendMail( choices). ).If you are actually not making use of the web server in nuxt, you can conveniently carry out on any kind of platform for example making use of show:.import show from 'share'.import nodemailer from 'nodemailer'.const app = express().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( multitude: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there planet',.html: theme,..await transporter.sendMail( possibilities).gain res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Documentation.Obtain the full information [here] ().Parts.You may find the elements, listed below:.Integrations.Emails constructed along with vue-email may be exchanged HTML or even.plain text, and also sent out using any sort of email specialist. You can easily find.instances right here:.