sipware-mailer
Advanced tools
Comparing version 0.3.0 to 0.3.1
22
index.js
@@ -12,2 +12,24 @@ const nm = require('nodemailer') | ||
// create VERP address if needed | ||
static verpify(address, detail) { | ||
if(typeof address === 'string') { | ||
var [user, domain] = address.split('@'); | ||
var [name, tag] = user.split('+'); | ||
detail = detail || tag; | ||
if(detail && detail.length) { | ||
return name + '+' + detail.replace('@', '=') + '@' + domain; | ||
} | ||
return address; | ||
} else if(typeof address == 'object') { | ||
detail = detail || address.tag; | ||
if(detail && detail.length) { | ||
return address.name + '+' + detail('@', '=') + '@' + address.domain; | ||
} | ||
return address.addr; | ||
} | ||
} | ||
mail() { | ||
@@ -14,0 +36,0 @@ console.log('SIPWARe MAILER', this.envelope, this.smtp); |
@@ -18,3 +18,3 @@ { | ||
"optionalDependencies": {}, | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"scripts": { | ||
@@ -21,0 +21,0 @@ "test": "mocha" |
36720
34