Permalink
Browse files

Enhancement to generateBody().

  • Loading branch information...
1 parent 0f7269c commit 1b480987fa3f30042ae200a33aa764893da38cc1 @lpatters lpatters committed Aug 23, 2011
Showing with 14 additions and 3 deletions.
  1. +14 −3 lib/mail.js
View
@@ -299,8 +299,13 @@ EmailMessage.prototype.generateBody = function(){
rows.push("Content-Type: text/plain; charset="+this.charset);
rows.push("Content-Transfer-Encoding: "+this.encoding); // Changed from quoted-printable; 5/23/2011.
rows.push("");
- // dots in the beginning of the lines will be replaced with double dots
- rows.push(mimelib.encodeQuotedPrintable(this.body.trim()).replace(/^\./gm,'..'));
+ /* Should we apply the quoted-printable conversion? */
+ if(this.encoding == "quoted-printable"){
+ // dots in the beginning of the lines will be replaced with double dots
+ rows.push(mimelib.encodeQuotedPrintable(this.body.trim()).replace(/^\./gm,'..'));
+ }else{
+ rows.push(this.body.trim());
+ }
rows.push("");
// html
@@ -309,7 +314,13 @@ EmailMessage.prototype.generateBody = function(){
rows.push("Content-Type: text/html; charset="+this.charset);
rows.push("Content-Transfer-Encoding: "+this.encoding); // Changed from quoted-printable; 5/23/2011.
rows.push("");
- rows.push(mimelib.encodeQuotedPrintable(this.html.trim()).replace(/^\./gm,'..'));
+ /* Should we apply the quoted-printable conversion? */
+ if(this.encoding == "quoted-printable"){
+ // dots in the beginning of the lines will be replaced with double dots
+ rows.push(mimelib.encodeQuotedPrintable(this.body.trim()).replace(/^\./gm,'..'));
+ }else{
+ rows.push(this.html.trim());
+ }
rows.push("");
}

0 comments on commit 1b48098

Please sign in to comment.