Restore to Mailbox not working when using auditor-user only works with personal users
I use Mailpiler not only to have an archive but also a Backup of all the emails.. so I would love to bulk-restore usign the auditor-user or at least restore users emails to their inbox wihtout loggin me in to all the accounts manually..
so.. what do I need to configure to make the auditor user abel to do that?
Comments (36)
-
repo owner -
reporter can I somehow use an account with a password for this? one I would define in “config-site.php”
-
repo owner I don’t follow. Each account should have a password.
-
reporter for the SMARTHOST I would need to use a user.
-
repo owner So you want to use authenticated smtp connection to restore the emails. In that case please show me AUTH mechanisms the smarthost supports.
Another solution might be to install postfix running on the localhost. Then configure it t use an appropriate authentication towards the smarthost, and finally configure the piler gui to use smarthost=127.0.0.1.
-
reporter Just to make sure we speak of the same thing. I want to use one user which is used just by the “auditor”-user to restore emails for any user. the users can restore their email with their normal password.
My Mail Server supports plain password over tls.
-
reporter @Janos SUTO any idea what I can do?
-
repo owner I’m sorry for the late response, however, I still don’t get it. Please clarify if the restore funcationality works from the gui. But I have the feeling that you want to restore a user’s emails to his mailbox without using the gui with a special role for this purpose. Am I getting closer?
-
reporter I try to clarify :)
So..
If a user logs himself into his own account on piler he can restore his emails to his mailbox.
If I log myself into the auditor-user. I can see download emails from all users but I cannot restore them into their inbox. → but I want to be able to do so.
-
repo owner When you click on the specified message you want to restore, then are the recipients' domains in the domain table in the piler mysql database?
Also when you select several messages with the checkbox on the left side can you restore the messages to the recipient of choice?
-
reporter when I use the user itself it works, but when I use the “builtin piler auditor” it doesnt.
there “Restore to mailbox“ and “bulk restores selected” doesnt work.
-
repo owner OK, I get it. But I asked you whether the recipients domains are in the domain table?
-
reporter where do I find the domain table?
-
repo owner In the piler mysql database. Also under the administration / domain menu when you login as an admin user.
-
reporter there is only “local”
-
reporter the login works using imap
-
reporter I just added the domain manually to test.. but it doesn't make a difference
-
repo owner It’s odd. When I select a message as an auditor and the domain of the message recipient’s address is not present in the domain table, then I get a small glitch on the gui. However, when it is, then I can see a checkbox with the email address.
-
reporter since I updated the Piler-Installation I also get this checkbox and it says “restored”. But it’s not. The restore only really works when I’m logged in as the user on mailpiler.
-
repo owner Can you show me some screenshots about the problem?
-
reporter you cannot see any problem on screenshots, as it looks as if its working but its not.
so when I do the restore usignt he “built-in piler auditor” it will allo wme to select the reciever of the restore and then after clicking the restore-button it says “restored” but it’s not.. when I do the resotr while logging in myself as the user on piler, the restore just works.
-
repo owner OK. Let’s dig a bit deeper. Run “ngrep -X port 25” on the archive when you restore as the auditor, and let’s check the smtp transaction. I’m interested in particularly the smarthost’s reponses. Also check the mail logs on the smarthost. There must be some error.
-
reporter where exactly can I run the “ngrep -X port 25” ?
-
repo owner Run “ngrep -X port 25” on the archive
-
reporter I don’t really get what “on the archive” means :) maybe you can post a screenshot?
-
repo owner You login to the archive host using ssh or similar, install ngrep package if it’s not there, and run ngrep.
-
reporter On my Mailserver I get:
13.12.2022, 13:40:36 err imap(525644): Error: auth-master: login: request [3459252225]: Login auth request failed: Authenticated user not found from userdb, auth lookup id=3459252225 (auth connected 1 msecs ago, request took 1 msecs, client-pid=525643 client-id=1) 13.12.2022, 13:40:36 err auth: Error: plain(auditor@local,10.255.255.7,<Dj8fe8fe9//9D>): user not found from any userdbs
-
reporter when I use the user it sends an email as the user
-
repo owner OK, we finally nailed it. You enabled IMAP restore, however, the auditor@local account doesn’t exist in the imap database. So either promote a real account as auditor or use smtp to restore emails.
-
repo owner - changed status to resolved
-
reporter so how do I promote my real account to be an auditor, if I still want to use the IMAP feature to check the password?
-
repo owner Use the CUSTOM_EMAIL_QUERY_FUNCTION feature, see the below example
$config['CUSTOM_EMAIL_QUERY_FUNCTION'] = 'my_custom_func'; function my_custom_func($username = '') { $session = Registry::get('session'); $data = $session->get("auth_data"); if($username == 'some@user') { $data['admin_user'] = 2; } $session->set("auth_data", $data); }
-
reporter with one user it works perfectly
how can I use multiple users?
-
repo owner Fix the if condition something like this:
$auditors = ['user1@domain','user2@domain',....]; if(in_array($username, $auditors)) { $data['admin_user'] = 2; }
-
reporter I just figured out that it doesnt work. it doesnt matter which E-Mail I restore it will always end up just in my mailbox (the mailbox of the auditor), even though I select another receiver.
-
repo owner It makes sense, because you set imap restore. I suggest to fix the settings to use SMTP restore. Btw. I wonder why don’t you let users to restore their own emails when they need it?
- Log in to comment
The auditor user should be able to restore the given email to any email address. Just click on the restore link or icon, and specify the recipient. Also be sure to set the SMARTHOST variable in config-site.php properly.