Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZMS-99 #551

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/message-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const { SettingsHandler } = require('./settings-handler');

// index only the following headers for SEARCH
const INDEXED_HEADERS = ['to', 'cc', 'subject', 'from', 'sender', 'reply-to', 'message-id', 'thread-index', 'list-id', 'delivered-to'];
const DISALLOWED_HEADERS_FOR_ADDRESS_REGISTER = ['list-id', 'auto-submitted', 'x-auto-response-suppress'];

openpgp.config.commentstring = 'Plaintext message encrypted by WildDuck Mail Server';
openpgp.config.versionString = `WildDuck v${packageData.version}`;
Expand Down Expand Up @@ -525,9 +526,21 @@ class MessageHandler {

if (parsed) {
let keyList = mailboxData.specialUse === '\\Sent' ? ['to', 'cc', 'bcc'] : ['from'];

for (const disallowedHeader of DISALLOWED_HEADERS_FOR_ADDRESS_REGISTER) {
// if email contains headers that we do not want,
// don't add any emails to address register
if (parsed[disallowedHeader]) {
return next();
}
}

for (let key of keyList) {
if (parsed[key] && parsed[key].length) {
for (let addr of parsed[key]) {
if (addr.address.includes('noreply') || addr.address.includes('no-reply')) {
NickOvt marked this conversation as resolved.
Show resolved Hide resolved
continue;
}
if (!addresses.some(a => a.address === addr.address)) {
addresses.push(addr);
}
Expand Down