Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

disableDotEscaping parameter added in the client object

  • Loading branch information...
commit ee4b1de7080b2db2588fdcda0badaf57c39b708a 1 parent d233c24
uniclau authored
Showing with 15 additions and 2 deletions.
  1. +1 −0  README.md
  2. +14 −2 lib/client.js
1  README.md
View
@@ -140,6 +140,7 @@ The following connection options can be used with `simplesmtp.connect`:
* **connectionTimeout** (system default if not set) - Time to wait in ms until the socket is opened to the server
* **rejectUnathorized** (defaults to false) - if set to true accepts only valid server certificates. You can override this option with the `tls` option, this is just a shorthand
* **dsn** - An object with methods `success`, `failure` and `delay`. If any of these are set to true, DSN will be used
+ * **disableDotEscaping** set to true if you want to bypass the dot escaping at the begining of each line. Default to false
### Connection events
16 lib/client.js
View
@@ -59,6 +59,8 @@ function SMTPClient(port, host, options){
this.options.secureConnection = !!this.options.secureConnection;
this.options.auth = this.options.auth || false;
this.options.maxConnections = this.options.maxConnections || 5;
+ this.options.disableDotEscaping = this.options.disableDotEscaping || false;
+
if(!this.options.name){
// defaul hostname is machine hostname or [IP]
@@ -423,8 +425,18 @@ SMTPClient.prototype.write = function(chunk){
if(typeof chunk == "string"){
chunk = new Buffer(chunk, "utf-8");
}
-
- chunk = this._escapeDot(chunk);
+
+ if (this.options.disableDotEscaping) {
+ if (chunk.length>=2) {
+ this._lastDataBytes[0] = chunk[chunk.length-2];
+ this._lastDataBytes[1] = chunk[chunk.length-1];
+ } else if (chunk.length==1) {
+ this._lastDataBytes[0] = this._lastDataBytes[1]
+ this._lastDataBytes[1] = chunk[0];
+ }
+ } else {
+ chunk = this._escapeDot(chunk);
+ }
if(this.options.debug){
console.log("CLIENT (DATA)"+(this.options.instanceId?" "+
Please sign in to comment.
Something went wrong with that request. Please try again.