Closed priyanka1098 closed 3 years ago
~Not sure what you mean. If you add a second user you have multiple users right?~
@louis-lau Thanks for the reply
My concern is that i have tested sending mail to single user. it's perfectly working.
But i'm not able to add multiple users in zone-mta.
Please suggest me how can i configure multiple user & multiple credentials. Please Help!
Riiiight, sorry. I did not realize this was an issue on ZoneMTA. ZMTA is like a framework, if you need authentication with multiple users you need to write a plugin. Seems like a duplicate of this issue?
I am very new to ZMTA so please help me to add more than one user and its credentials. i have used this plugin /zone-mta-template/plugins/example-auth.js for using user authentication . it is working only for single user. how can i configure in this file for multiple users. Thanks for help.
It's just JavaScript, you can do whatever you want. In the addhook function call next() if you want authentication to succeed, throw an error if you want the authentication to fail. Tha logic is up to you, this logic doesn't have to do anything with ZoneMTA. It's JavaScript :)
Sorry , I don't know JavaScript or any other programming language . so could please help me with the code for adding more users & their credentials.
If you just want a working MTA application then you should probably look at Postfix instead. ZoneMTA is meant for setups that need more custom approach than what Postfix could provide.
I have added an API to support auth with many users
Add user to collection users
db.users.insert({"username": "user", "password": "pass"})
Add API to lib/api-server.js
this.server.get('/auth', (req, res, next) => {
let time = new Date().toISOString();
this.queue.mongodb
.collection('users')
.findOne({"username": decodeURIComponent(req.username)}, function (err, result) {
if (err) throw err;
// console.log(result);
if (result === null ||decodeURIComponent(req.authorization.basic.password) !== decodeURIComponent(result.password)) {
res.statusCode = 401;
res.setHeader('WWW-Authenticate', 'Basic realm="Secure Area"');
return res.json({
time,
error: 'Authentication required'
});
}
res.json({
user: req.username,
time
});
});
// the actual response does not matter as long as it's 2xx range
next();
});
@priyanka1098 : Hope it can help you
Can we close this ?
@andris9 close ?
Hii all, I am new to zone-mta . I have installed zone-mta in ubuntu 16.04 and also configured a user for sending mail which was perfectly working. but it works only in case of single user and not in multiple users . could you please tell me how can i configure it for multiple users.
Thanks for Help!!