Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A Node.js module for sending error emails using the Nodemailer library.
npm i errormail
const ErrorMail = require('errormail');
const errorMail = new ErrorMail({
transporter: {
service: 'gmail',
auth: {
user: 'youremail@gmail.com',
pass: 'yourpassword',
}
},
receiver: {
to: 'recipient@example.com',
},
showLogs: true,
});
//Usage Example1
const error = new Error('Something went wrong');
errorMail.sendError(error, 'optional-recipient@example.com', 'Optional Subject')
.then(info => {
console.log(`Error email sent: ${info.response}`);
})
.catch(err => {
console.error('Error sending email:', err);
});
//Usage Example2
fs.readFile('path/file/errors.txt', (err, chunk) => {
if (err) {
errorMail.sendError(
err,
'optional-recipient@example.com',
'Optional Subject'
);
}
...
});
//Usage Example3
(async () => {
try {
await fs.promises.('path/file/errors.txt');
} catch (err) {
const sendedError = await errorMail.sendError(err, 'optional-recipient@example.com');
console.log(sendedError);
//handle err...
}
})();
The ErrorMail constructor takes an options object with the following properties:
const errorMail = new ErrorMail({
transporter: {
service: 'gmail', // String specifying the email service. Default is 'gmail'.
auth: {
user: 'sender@example.com', // String specifying the email address of the sender.
pass: 'password' // String specifying the password for the email address of the sender.
}
},
receiver: {
to: 'recipient@example.com' // String specifying the email address of the recipient.
},
showLogs: false // Boolean specifying whether to show logs in the console. Default is false.
});
When creating an instance of the ErrorMail class, you can provide the following options:
The ErrorMail constructor takes an options object with the following properties:
transporter:
Object specifying the email service and authentication credentials. Required properties:
service:
String specifying the email service. Default is 'gmail'.
auth:
Object specifying the authentication credentials. Required properties:
user:
String specifying the email address of the sender.
pass:
String specifying the password for the email address of the sender.
receiver:
Object specifying the default recipient. Required properties:
to:
String specifying the email address of the recipient.
showLogs:
Boolean specifying whether to show logs in the console. Default is false.
The sendError method is thenable
and takes three optional parameters:
errorMail.sendError(error, to, subject);
error:
Error object or string representing the error message.
to:
String specifying an optional recipient for the email.
subject:
String specifying an optional subject line for the email.
const options = {
transporter: {
service: 'gmail',
auth: {
user: 'youremail@gmail.com',
pass: 'yourpassword'
}
},
receiver: {
to: 'recipient1@example.com, recipient2@example.com'
},
showLogs: true
};
const errorMail = new ErrorMail(options);
License This project is licensed under the MIT License - see the LICENSE file for details.
This README.md
file includes information on how to install the module, as well as an example usage snippet that shows how to create an instance of the ErrorMail
class and send an error email with optional recipient and subject parameters.
It also includes an Options
section that describes the properties of the options object that can be passed to the ErrorMail
constructor, as well as the optional parameters for the sendError
method.
Finally, it includes a License
section that describes the license for the module.
FAQs
Error mail sender
The npm package errormail receives a total of 0 weekly downloads. As such, errormail popularity was classified as not popular.
We found that errormail demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.