• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Display Through Command Line Mailbox Forwarding Addresses.

ArshadM

New Pleskian
I have several mailbox with mail forwarding addresses. With the passage of time it's becomes difficult to login to Plesk & go to each mailbox & review the email addresses to which the emails are being forwarded. We have several departments & each dept email is forwarded to the relevant staff for action & many times need review which email is being forwarded to which staff.

Is it possible to have summary of all mail forwarding addresses through command in the following way.

mailbox
[email protected]

Mail Forwarding To
[email protected]
[email protected]
[email protected]

mailbox
[email protected]

Mail Forwarding To
[email protected]
[email protected]
[email protected]

I think there must be some way similar to the way we can get the list of all email id with passwords of all the domains through the command /usr/local/psa/admin/sbin/mail_auth_view

Please help. How to achieve this task.
 
Last edited:
AFAIK there's no easy way to list all mails with forwarders from the CLI tools (see: mail: Mail Accounts)
But you could pull this info directly from the database, like this:
Code:
plesk db "SELECT concat(mail.mail_name,'@',domains.name) AS 'Email address',mail_redir.address AS 'Forward' FROM mail LEFT JOIN mail_redir ON mail.id=mail_redir.mn_id LEFT JOIN domains ON mail.dom_id=domains.id WHERE mail_redir.address <> ''"

I'm pretty sure there's a much more elegant way to do it but Works For Me (tm)
 
Simply add some WHERE clauses to the SQL statement, so for your example it would be:
Code:
plesk db "SELECT concat(mail.mail_name,'@',domains.name) AS 'Email address',mail_redir.address AS 'Forward' FROM mail LEFT JOIN mail_redir ON mail.id=mail_redir.mn_id LEFT JOIN domains ON mail.dom_id=domains.id WHERE mail_redir.address <> '' AND mail.mail_name = 'finance' AND domains.name = 'domain.com'"
 
Back
Top