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.*
package-lock.json*
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(
{
user: userData._id,
userEmail: userData.address,
reason: 'submit',
from: envelope.from,
to: envelope.to,

View file

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

View file

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

View file

@ -97,7 +97,12 @@ class Maildropper {
};
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) {