Skip to content
Browse files

Merge pull request #39 from lpatters/master

Enhancement to generateBody().
  • Loading branch information...
2 parents 0f7269c + 1b48098 commit 21023d76c272d58de58ce05a8d0948c40a1033ef @andris9 andris9 committed Aug 23, 2011
Showing with 14 additions and 3 deletions.
  1. +14 −3 lib/mail.js
View
17 lib/mail.js
@@ -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 21023d7

Please sign in to comment.
Something went wrong with that request. Please try again.