text: //send email module
  var nodemailer = require('nodemailer');
  
  var emailTransport = function(setting) {
      this.setting = setting;
      this.transport = null;
      
      //console.log('emailEngine setting:', setting);
      if (setting.service) {
          this.transport = nodemailer.createTransport(setting.service, {
              auth: {
                  user: setting.username,
                  pass: setting.password
              }
          }); 
      } else {
          this.transport = nodemailer.createTransport('SMTP', {
              host: setting.hostname,
              secureConnection: setting.secureConnection || false,
              port: setting.port || 465, 
              auth: {
                  user: setting.username,
                  pass: setting.password
              }
          });
      }
      
      /*
      nodemailer.SMTP = {
          host: this.setting.email_host, // required
          port: this.setting.email_port, // optional, defaults to 25 or 465
          use_authentication: this.setting.email_authentication, // optional, false by default
          user: this.setting.email_username, // used only when use_authentication is true 
          pass: this.setting.email_password  // used only when use_authentication is true
      };
      */
  };
  
  /**
   * use SMTP to send email
   */
  emailTransport.prototype.send = function(email) {
      
      // if content is empty, no need to send email
      if (!email.content) {
          return;
      }
      
      var mailOptions = {
          from: email.from || this.setting.sender,
          to: email.to,
          subject: email.subject
      };
      
      if (email.isHtml) {
          mailOptions.html = email.content;
      } else {
          mailOptions.text = email.content;
      }
      
      // add support email to bcc if available
      if (this.setting.bcc && this.setting.bcc != email.to) {
          mailOptions.bcc = this.setting.email_bcc;
      }
      
      var callback = email.callback || this.setting.callback || this.defaultCallback;
      this.transport.sendMail(mailOptions, callback);
  };
  
  emailTransport.prototype.defaultCallback = function(error, response) {
      if (error) {
          console.log(error);
      } else {
          console.log("Message sent: " + response.message);
      }
  }
  
  exports.Engine = emailTransport;
  
  