fix(xo-server-transport-email): fix From header

Fix vatesfr/xo-web#2074
This commit is contained in:
Julien Fontanet
2017-04-10 11:32:13 +02:00
parent d2af0152d0
commit e2d4a41d9a

View File

@@ -4,6 +4,15 @@ import { promisify } from 'promise-toolbox'
// ===================================================================
const removeUndefined = obj => {
Object.keys(obj).forEach(key => {
if (obj[key] === undefined) {
delete obj[key]
}
})
return obj
}
const markdownCompiler = nodemailerMarkdown()
const logAndRethrow = error => {
@@ -193,8 +202,7 @@ The transport-email plugin for Xen Orchestra server seems to be working fine, ni
markdown,
attachments
}) {
// TODO: handle errors
return this._send({
return this._send(removeUndefined({
from,
to,
cc,
@@ -202,7 +210,7 @@ The transport-email plugin for Xen Orchestra server seems to be working fine, ni
subject,
markdown,
attachments
}).catch(logAndRethrow)
})).catch(logAndRethrow)
}
}