• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

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