Skip to content
This repository
Browse code

added optional output character set option

  • Loading branch information...
commit a1c36aa6d2e17c3f1b348974c04f63ce7acdd421 1 parent 71ddc6b
Andris Reinman authored

Showing 3 changed files with 12 additions and 5 deletions. Show diff stats Hide diff stats

  1. +1 0  README.md
  2. +10 4 lib/nodemailer.js
  3. +1 1  package.json
1  README.md
Source Rendered
@@ -409,6 +409,7 @@ The following are the possible fields of an e-mail message:
409 409 - **envelope** - optional SMTP envelope, if auto generated envelope is not suitable
410 410 - **messageId** - optional Message-Id value, random value will be generated if not set. Set to false to omit the Message-Id header
411 411 - **encoding** - optional transfer encoding for the textual parts (defaults to "quoted-printable")
  412 + - **charset** - optional output character set for the textual parts (defaults to "utf-8")
412 413
413 414 All text fields (e-mail addresses, plaintext body, html body) use UTF-8 as the encoding.
414 415 Attachments are streamed as binary.
14 lib/nodemailer.js
@@ -82,16 +82,22 @@ function sendMail(options, callback){
82 82 * @param {Object} options Message options object, see README for the complete list of possible options
83 83 */
84 84 function Nodemailer(options){
  85 + var mailcomposerOptions = {};
  86 +
85 87 this.options = options || {};
86 88
87 89 this.transport = this.options.transport;
88 90
89   - if( this.options.encoding ){
90   - this.mailcomposer = new MailComposer({encoding: this.options.encoding});
91   - } else {
92   - this.mailcomposer = new MailComposer();
  91 + if(this.options.encoding){
  92 + mailcomposerOptions.encoding = this.options.encoding;
  93 + }
  94 +
  95 + if(this.options.charset){
  96 + mailcomposerOptions.charset = this.options.charset;
93 97 }
94 98
  99 + this.mailcomposer = new MailComposer(mailcomposerOptions);
  100 +
95 101 if(!this.transport){
96 102 this.transport = this.getGlobalTransport();
97 103 }
2  package.json
... ... @@ -1,7 +1,7 @@
1 1 {
2 2 "name": "nodemailer",
3 3 "description": "Easy to use module to send e-mails, supports unicode and SSL/TLS",
4   - "version": "0.3.29",
  4 + "version": "0.3.30",
5 5 "author" : "Andris Reinman",
6 6 "maintainers":[
7 7 {

0 comments on commit a1c36aa

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