
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mailsender-pro
Advanced tools
An advanced npm package to generate and send OTPs via email for verification purposes with enhanced features.
An advanced npm package to generate and send OTPs via email for verification purposes with enhanced features.
To install the package, use npm:
npm install mailsender-pro
Usage
1. Check SMTP Server Details
Make sure you are using the correct SMTP server address and port for your email provider. Here’s a general guide:
Gmail: smtp.gmail.com, port 587 (STARTTLS) or port 465 (SSL)
SendGrid: smtp.sendgrid.net, port 587 (STARTTLS)
Mailgun: smtp.mailgun.org, port 587 (STARTTLS)
Amazon SES: email-smtp.us-east-1.amazonaws.com, port 587 (STARTTLS) or port 465 (SSL)
2. Update Configuration
Update your nodemailer configuration in index.js to use the correct SMTP server and port.
Example for SendGrid:
const transporter = nodemailer.createTransport({
host: 'smtp.sendgrid.net', // SMTP server host
port: 587, // Port for STARTTLS
secure: false, // Use TLS/STARTTLS
auth: {
user: 'apikey', // This is the literal string 'apikey'
pass: process.env.SENDGRID_API_KEY, // Your SendGrid API key
},
});
Example for Mailgun:
const transporter = nodemailer.createTransport({
host: 'smtp.mailgun.org',
port: 587, // Port for STARTTLS
secure: false, // Use TLS/STARTTLS
auth: {
user: process.env.MAILGUN_USER,
pass: process.env.MAILGUN_PASS,
},
});
Example for Amazon SES:
const transporter = nodemailer.createTransport({
host: 'email-smtp.us-east-1.amazonaws.com',
port: 587, // Port for STARTTLS
secure: false, // Use TLS/STARTTLS
auth: {
user: process.env.AWS_SES_USER,
pass: process.env.AWS_SES_PASS,
},
});
3. Test Connectivity
To ensure your SMTP server is reachable, you can manually test the connection using tools like telnet or openssl:
For telnet:
telnet smtp.sendgrid.net 587
For openssl:
openssl s_client -connect smtp.sendgrid.net:465
# Generate OTP
Generate a One-Time Password (OTP):
const { generateOtp } = require('mailsender-pro');
const otp = generateOtp(6, { upperCaseAlphabets: true, specialChars: true });
console.log(`Generated OTP: ${otp}`);
# Encrypt OTP
Encrypt an OTP for secure storage:
const { encryptOtp } = require('mailsender-pro');
const encryptedOtp = encryptOtp('123456');
console.log(`Encrypted OTP: ${encryptedOtp}`);
# Decrypt OTP
Decrypt an OTP for verification:
const { decryptOtp } = require('mailsender-pro');
const decryptedOtp = decryptOtp('encryptedOtpString');
console.log(`Decrypted OTP: ${decryptedOtp}`);
# Validate OTP
Validate if the provided OTP matches the generated OTP:
Validate OTP
Validate if the provided OTP matches the generated OTP:
# Send OTP
Send an OTP via email:
const { sendOtp } = require('mailsender-pro');
const mailOptions = {
to: 'recipient@example.com',
subject: 'Your OTP Code',
otpLength: 6,
customMessage: 'Your OTP code is {otp}. This code is valid for 10 minutes.',
otpExpiresIn: 10,
html: '<h1>Your OTP Code</h1><p>{otp}</p>',
attachments: [
{
filename: 'test.txt',
content: 'This is a test file'
}
],
embedImages: true
};
sendOtp('recipient@example.com', '123456', mailOptions)
.then(() => console.log('OTP sent successfully!'))
.catch(error => console.error('Error sending OTP:', error));
# Development
Running Tests
To run the tests for the package, use:
npm test
#Contributing
Fork the repository.
Create a new branch (git checkout -b feature/your-feature).
Make your changes.
Commit your changes (git commit -am 'Add new feature').
Push to the branch (git push origin feature/your-feature).
Create a new Pull Request.
#Authors
Hitank Shah - Hitankjain@gmail.com
Maharshi Agrawal - maharshiagrawal93@gmail.com
Saksham Jain - jainsaksham0101001@gmail.com
Vedant Dongare - dongrevedant79@gmail.com
FAQs
An advanced npm package to generate and send OTPs via email for verification purposes with enhanced features.
The npm package mailsender-pro receives a total of 0 weekly downloads. As such, mailsender-pro popularity was classified as not popular.
We found that mailsender-pro demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.