prefer user email as the username for plugins

This commit is contained in:
Andris Reinman 2022-06-27 11:49:07 +03:00
parent 28cf0e9ff1
commit 032c468e8a
No known key found for this signature in database
GPG key ID: DC6C83F4D584D364
5 changed files with 11 additions and 3 deletions

2
.gitignore vendored
View file

@ -6,3 +6,5 @@ config/production.*
config/development.* config/development.*
package-lock.json* package-lock.json*
certs/test-* certs/test-*
zmta-milter
zmta-milter.toml

View file

@ -2992,6 +2992,7 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
let message = maildrop.push( let message = maildrop.push(
{ {
user: userData._id, user: userData._id,
userEmail: userData.address,
reason: 'submit', reason: 'submit',
from: envelope.from, from: envelope.from,
to: envelope.to, to: envelope.to,

View file

@ -465,6 +465,7 @@ module.exports = (db, server, messageHandler, userHandler, settingsHandler) => {
let message = maildrop.push( let message = maildrop.push(
{ {
user: userData._id, user: userData._id,
userEmail: userData.address,
parentId: messageId, parentId: messageId,
reason: 'submit', reason: 'submit',
from: compiledEnvelope.from, from: compiledEnvelope.from,

View file

@ -13,8 +13,7 @@ module.exports = (options, callback) => {
targets: options.targets, targets: options.targets,
interface: 'forwarder', interface: 'forwarder'
runPlugins: true
}; };
let message = options.maildrop.push(mail, (err, ...args) => { let message = options.maildrop.push(mail, (err, ...args) => {

View file

@ -97,7 +97,12 @@ class Maildropper {
}; };
if (options.user) { if (options.user) {
envelope.user = options.user.toString(); envelope.userId = options.user.toString();
}
if (options.userEmail) {
// prefer email address as the username
envelope.user = options.userEmail;
} }
if (options.parentId) { if (options.parentId) {