• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

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