Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap-cloud-sdk/mail-client

Package Overview
Dependencies
Maintainers
0
Versions
734
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-cloud-sdk/mail-client - npm Package Compare versions

Comparing version 3.22.2-20241010014057.0 to 3.22.2-20241010084441.0

17

dist/mail-client-types.d.ts

@@ -330,18 +330,1 @@ import type { Readable } from 'stream';

}
/**
* @internal
*/
interface ReadableState {
readableListening: boolean;
}
/**
* Represents a socket object used for On-Premise proxy.
* @internal
*/
export interface SocksSocket extends net.Socket {
/**
* @internal
*/
_readableState: ReadableState;
}
export {};

45

dist/mail-client.js

@@ -88,9 +88,42 @@ "use strict";

};
const socketConnection = await socks_1.SocksClient.createConnection(connectionOptions);
const socksSocket = socketConnection.socket;
// Setting `_readableListening` to true in the next line makes the socket readable.
// Otherwise nodemailer is not able to receive the SMTP greeting message and send emails.
socksSocket._readableState.readableListening = true;
return socksSocket;
const { socket } = await socks_1.SocksClient.createConnection(connectionOptions);
// Workaround for incorrect order of events in nodemailer https://github.com/nodemailer/nodemailer/issues/1684
await resendGreetingUntilReceived(socket);
return socket;
}
function retrieveGreeting(socket) {
logger.debug('Waiting for SMTP greeting message...');
return new Promise((resolve, reject) => {
const onData = data => {
logger.debug(`Data received from mail socket: ${data?.toString()}`);
if (data?.toString().startsWith('220')) {
logger.debug('Removing mail socket listeners...');
socket.removeListener('data', onData);
socket.removeListener('error', onError);
resolve(data);
}
};
const onError = err => {
reject(new Error(err));
};
socket.on('data', onData);
socket.on('error', onError);
});
}
async function resendGreetingUntilReceived(socket) {
const greeting = await retrieveGreeting(socket);
// resend the greeting message every second until a listener is attached
const intervalId = setInterval(() => {
// note: this is dangerous because there could be another listener that is not the mailer
if (socket.listenerCount('data')) {
socket.emit('data', greeting);
clearInterval(intervalId);
clearTimeout(timeoutId);
}
}, 1000);
const timeoutId = setTimeout(() => {
clearInterval(intervalId);
// default greeting timeout from nodemailer
}, 30 * 1000);
}
function createTransport(mailDestination, mailClientOptions, socket) {

@@ -97,0 +130,0 @@ const baseOptions = {

{
"name": "@sap-cloud-sdk/mail-client",
"version": "3.22.2-20241010014057.0",
"version": "3.22.2-20241010084441.0",
"description": "SAP Cloud SDK for JavaScript e-mail client",

@@ -41,4 +41,4 @@ "homepage": "https://sap.github.io/cloud-sdk/docs/js/overview",

"dependencies": {
"@sap-cloud-sdk/connectivity": "^3.22.2-20241010014057.0",
"@sap-cloud-sdk/util": "^3.22.2-20241010014057.0",
"@sap-cloud-sdk/connectivity": "^3.22.2-20241010084441.0",
"@sap-cloud-sdk/util": "^3.22.2-20241010084441.0",
"nodemailer": "6.9.15",

@@ -45,0 +45,0 @@ "socks": "2.8.3"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc