Socket
Socket
Sign inDemoInstall

smtp-server

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smtp-server - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

18

examples/server.js

@@ -66,5 +66,15 @@ 'use strict';

onRcptTo: function(address, session, callback) {
var err;
if (/^deny/i.test(address.address)) {
return callback(new Error('Not accepted'));
}
// Reject messages larger than 100 bytes to an over-quota user
if (address.address.toLowerCase() === 'almost-full@example.com' && Number(session.envelope.mailFrom.args.SIZE) > 100) {
err = new Error('Insufficient channel storage: ' + address.address);
err.responseCode = 452;
return callback(err);
}
callback();

@@ -76,7 +86,7 @@ },

stream.pipe(process.stdout);
stream.on('end', function(){
stream.on('end', function() {
var err;
if(stream.sizeExceeded){
err = new Error('Maximum allowed message size 1kB exceeded');
err.statusCode = 552;
if (stream.sizeExceeded) {
err = new Error('Error: message exceeds fixed maximum message size 10 MB');
err.responseCode = 552;
return callback(err);

@@ -83,0 +93,0 @@ }

@@ -171,3 +171,7 @@ 'use strict';

SMTPConnection.prototype._onClose = function( /* hadError */ ) {
this._parser = false;
if (this._parser) {
this._parser.closed = true;
this._socket.unpipe(this._parser);
this._parser = false;
}

@@ -174,0 +178,0 @@ if (this._dataStream) {

@@ -37,2 +37,4 @@ 'use strict';

this._lastBytes = false;
this.closed = false;
// once the input stream ends, flush all output without expecting the newline

@@ -82,5 +84,5 @@ this.on('finish', this._flushData.bind(this));

*/
SMTPStream.prototype._write = function(chunk, encoding, done) {
SMTPStream.prototype._write = function(chunk, encoding, next) {
if (!chunk || !chunk.length) {
return done();
return next();
}

@@ -92,2 +94,16 @@

var called = false;
var done = function() {
if (called) {
return;
}
called = true;
var args = [].slice.call(arguments);
next.apply(null, args);
};
if (this.closed) {
return done();
}
if (!this._dataMode) {

@@ -234,3 +250,3 @@

var line;
if (this._remainder) {
if (this._remainder && !this.closed) {
line = this._remainder;

@@ -237,0 +253,0 @@ this._remainder = '';

{
"name": "smtp-server",
"version": "1.4.0",
"version": "1.4.1",
"description": "Create custom SMTP servers on the fly",

@@ -5,0 +5,0 @@ "main": "lib/smtp-server.js",

@@ -27,3 +27,3 @@ # smtp-server

```javascript
var server = new SMTPserver(options);
var server = new SMTPServer(options);
```

@@ -272,3 +272,3 @@

When creating the server you can define maximum allowed message size with the `size` option, see [RFC1870](https://tools.ietf.org/html/rfc1870) for details. This is not a strict limitation, the client is informed about the size limit but the client can still send a larger message than allowed, it is up to your application to reject or accept the oversized message. To check if the message was oversized, see `stream.sizeExceeded` option.
When creating the server you can define maximum allowed message size with the `size` option, see [RFC1870](https://tools.ietf.org/html/rfc1870) for details. This is not a strict limitation, the client is informed about the size limit but the client can still send a larger message than allowed, it is up to your application to reject or accept the oversized message. To check if the message was oversized, see `stream.sizeExceeded` property.

@@ -283,4 +283,4 @@ ```javascript

if(stream.sizeExceeded){
err = new Error('Maximum allowed message size 1kB exceeded');
err.statusCode = 552;
err = new Error('Message exceeds fixed maximum message size');
err.responseCode = 552;
return callback(err);

@@ -366,2 +366,3 @@ }

* **SMTPUTF8** accepts unicode e-mail addresses like *δοκιμή@παράδειγμα.δοκιμή*
* **SIZE** limits maximum message size

@@ -368,0 +369,0 @@ Most notably, the **ENHANCEDSTATUSCODES** extension is not supported, all response codes use the standard three digit format and nothing else. I might change this in the future if I have time to revisit all responses and find the appropriate response codes.

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