• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

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