So i have the main nodejs server file (myserver.js)

```
const express = require("express");
const app = express();

const nodemailer = require("nodemailer");
const port = 80; 
const vectorExpress = require("./node_modules/@smidyo/vectorexpress-nodejs/index");
const fs = require("fs");
var cors = require("cors");
app.use(cors());

app.use(express.json())

var randomnum = require('./randomnum.js');
var number = randomnum.number;

app.post('/mail', (req, res)=>{
  console.log(req.body)

  let transporter = nodemailer.createTransport({
    service: 'Gmail', 
    auth: {
        user: '',
        pass: ''
    }
});

const mailOptions = {
from: req.body.email,
to: 'naizeylines.info@gmail.com', 
subject: `Order from ${req.body.name}`,
text: 
`${req.body.name}  
${req.body.street}
${req.body.postcode} ${req.body.town}
${req.body.country}

Quantity: ${req.body.quantity}
Additional information:
${req.body.message}

Shipping address:
${req.body.name2}  
${req.body.street2}
${req.body.postcode2} ${req.body.town2}
${req.body.country2}
${req.body.phone2}

Email: ${req.body.email}
Phone number: ${req.body.phone}

File number: ${number}

    `,
    attachments: [{   // utf-8 string as an attachment
      path: `${number}.svg`,
      },
      {
      path: `${number}.dxf`,
      },
    ]
  }

  transporter.sendMail(mailOptions, (error, info)=>{
    if(error){
      console.log(error);
      res.send('error');
    }else{
      console.log('Email sent:' + info.response);
      res.send('success');
    }
  })
})

var bodyParser = require("body-parser");

```

and a seperate script file (randomnum.js)

```
function randomnumber() {
  return Math.floor(100000 + Math.random() * 900000);
}

var number = randomnumber();
exports.number = number;
console.log(number);

```

i would like to have it so that everytime nodemailer sends an email the main script would run the randomnum.js so that i would get a new random number generated. been trying for a few days now but i think im in over my head with my limited knowledge.