Sleep

Vue- Email - Vue.js Supplied

.Vue-email is influenced through react-email, it enables our company produce design templates utilizing the vue framework, with parts that aid our company develop themes simply and quickly.To start making use of vue-email in any sort of vue task, you just require to install the deal:.With NPM:.$ npm put in vue-email.With Anecdote:.$ yarn include vue-email.Along with PNPM:.$ pnpm set up vue-email.Producing email design template.Develop a brand new email layout in wherever you would like to have your design templates, for this situation, our company may make a design template directory, with a template contacted welcome.vue.src/templates/welcome. vue.

label, invited to vue-email.A Vue part collection for building receptive e-mails.Perspective on GitHub.Satisfied coding!David Arenas.
Rendering the themes.Our company can easily use the leave function, it gets 2 params, the initial one is actually the layout to provide, as well as the 2nd the params to be utilized for the theme, and afterwards pass the outcome theme in the body of ask for.Passing the template in the body, provide our team the odds of making using any sort of server, express, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Mailed email.
Deliver email.In this particular instance i using nuxt v3 since it enables our team to prepare api inside personal job, as well as describe a number of api courses.Listed below our experts simply draw out the design template of the demand physical body, and deliver the email passing the design template in the sendMail function of the nodemailer plan.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body system = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello world',.html: body.template,..await transporter.sendMail( options). ).If you are actually certainly not using the hosting server in nuxt, you may conveniently carry out on any sort of structure for instance making use of show:.import show coming from 'share'.bring in nodemailer from 'nodemailer'.const application = express().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.protected: false,.auth: individual: testAccount.user,.elapsed: testAccount.pass,.,. ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there planet',.html: template,..await transporter.sendMail( options).gain res.json( information: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Acquire the full information [right here] ().Parts.You can observe the elements, listed below:.Integrations.Emails built along with vue-email may be exchanged HTML or even.plain text, and sent using any e-mail company. You can easily see.instances here:.