smtp/client: fix type error in bundle

This commit is contained in:
Zack Schuster 2022-05-06 17:57:47 -07:00
parent f0728717b9
commit fabbca8de5
1 changed files with 10 additions and 7 deletions

View File

@ -100,17 +100,20 @@ export class SMTPClient {
}
) {
const [{ address: from = '' }] = addressparser(message.header.from);
const stack: MessageStack = {
message,
to: [],
from,
callback: callback.bind(this),
};
const {
header: { to, cc, bcc, 'return-path': returnPath },
} = message;
const stack: MessageStack = {
message,
to:
(typeof to === 'string' || Array.isArray(to)) && to.length > 0
? addressparser(to)
: [],
from,
callback: callback.bind(this),
};
if ((typeof to === 'string' || Array.isArray(to)) && to.length > 0) {
stack.to = addressparser(to);
}