summaryrefslogtreecommitdiffstats
path: root/lib/email.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/email.js')
-rw-r--r--lib/email.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/email.js b/lib/email.js
index c369530..902dd46 100644
--- a/lib/email.js
+++ b/lib/email.js
@@ -52,9 +52,17 @@ function Email(params) {
}
}
-Email.prototype.addHeader = function(object_literal) {
- if (_.isObject(object_literal)) {
- _.extend(this.headers, object_literal);
+Email.prototype.addHeader = function(object_literal_or_key, value) {
+ if (typeof value === "undefined" || value === null) {
+ value = "";
+ }
+
+ if (_.isObject(object_literal_or_key)) {
+ _.extend(this.headers, object_literal_or_key);
+ } else {
+ var object_to_add = {}
+ object_to_add[object_literal_or_key] = value;
+ _.extend(this.headers, object_to_add);
}
};