I have a NodeJS script utilizing Nodemailer to send an email with the Linux system information of the device the script is running on once a button is pressed in my application.
Below is a shortened excerpt from the script:
const nodemailer = require('nodemailer');
...
...
// Message object
let message = {
// Comma separated list of recipients
to: 'Nodemailer <example@nodemailer.com>',
// Subject of the message
subject: 'Test message ' + Date.now(),
// HTML body
html: `<p><b>Hello</b>, below is some sample system information</p>
<p>{{ip-address}} {{os-version}}<br/></p>`,
How can I replace the example text {{ip-address}}
and {{os-version}}
with values from a variable?
Note: One thought I had was perhaps to save the value of a shell command executed by cp.exec
to a variable, but my obstacle remains how to pass the contents of that variable to the placeholder text.
The information saved to {{ip-address}}
and {{os-version}}
isn't static so I can't just set permanent .ENV variables and call it day, I need to get fresh information every time this script is run.