Find Mail Redirects in Plesk and cPanel
We are receiveing too many mail bouncing issues with google/gmail and other giant mail service providers. Most of the case the issue occured due to the redirects form the server. In case of redirects, it will redirect spam mails also and at receiver end, it treat as mails sending from our server and causing the blacklist. Following are the options to find the redirects from Plesk and cPanel servers.
From plesk the redirect entries can be collect from psa database. it require some basic knowledge in SQL queries.
Login into mysql and select psa database
#mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa
Collect all redirects to gmail.com using SQL queries, you can replace gmail.com with the string required.
mysql> select m.mail_name,d.name,r.address from mail m,domains d,mail_redir r where d.id=m.dom_id and r.mn_id=m.id and r.address like '%gmail.com%' ;
SQL Query for collecting all redirects
mysql> select m.mail_name,d.name,r.address from mail m,domains d,mail_redir r where d.id=m.dom_id and r.mn_id=m.id ;
Note: Do not modify any values from backend for psa database, since it is linked to different tables, so it will break the entire plesk. Modify only if you are familiar with the psa database structure. Once you get the list, you can delete/modify the redirects from plesk front end.
In cPanel the forwarder entries for domain are saved in file /etc/valiases/domainname.com, seperate files for each domain.
# grep gmail.com /etc/valiases/*