• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Disabiling e-mail Forwarding

Eric Pretorious

Regular Pleskian
Like most hosters - I'm sure - many of our clients create e-mail accounts that forward incoming e-mail to mailboxes hosted on other e-mail services. e.g., Gmail.

Lately, though, a handful of these accounts have been receiving a lot of spam (i.e., UCE) and that's been causing a lot of damage to our reputation with these other e-mail services because the message that's being forwarded appears to have originated from our servers.
Code:
<someuser@gmail.com>: host gmail-smtp-in.l.google.com[64.233.183.27]
    said: 552-5.7.0 This message was blocked because its content presents a
    potential 552-5.7.0 security issue. Please visit 552-5.7.0
    http://support.google.com/mail/bin/answer.py?answer=6590 to review our 552
    5.7.0 message content and attachment content guidelines.
    g20si28780491ici.46 - gsmtp (in reply to end of DATA command)

Is there some way to...
  1. find accounts that are configured to forward to gmail?
  2. disable forwarding in accounts that are configured to forward to gmail?
 
After reading Shall's code samples in the forum post 'Extract "all valid emails"?' I've been able to...

  • Identify virtual mailboxes that have redirects configured:
    Code:
    mysql> SELECT mail.id, CONCAT(mail.mail_name,'@',domains.name) FROM mail LEFT JOIN domains ON domains.id = mail.dom_id WHERE mail.redirect = true;
  • Identify e-mail redirects addresses:
    Code:
    mysql> SELECT mail_redir.mn_id,mail_redir.address FROM mail_redir ;
...but I can't quite figure out how to join the three tables: mail, domains, and mail_redir to correlate e-mail redirects with virtual mailboxes.

Is that even possible in SQL?

TIA,
 
After reading Shall's code samples in the forum post 'Extract "all valid emails"?' I've been able to...

  • Identify virtual mailboxes that have redirects configured:
    Code:
    mysql> SELECT mail.id, CONCAT(mail.mail_name,'@',domains.name) FROM mail LEFT JOIN domains ON domains.id = mail.dom_id WHERE mail.redirect = true;
  • Identify e-mail redirects addresses:
    Code:
    mysql> SELECT mail_redir.mn_id,mail_redir.address FROM mail_redir ;
...but I can't quite figure out how to join the three tables: mail, domains, and mail_redir to correlate e-mail redirects with virtual mailboxes.

Is that even possible in SQL?

I was able to leverage more of Shall's code to find the answer:

Code:
mysql> SELECT CONCAT(mail.mail_name,'@',domains.name) AS 'virtual mailbox', mail_redir.address AS 'redirects to' FROM mail_redir,mail,domains WHERE mail_redir.mn_id = mail.id AND mail.dom_id = domains.id AND mail.redirect = true ;
+---------------------------------+-----------------------------------+
| virtual mailbox                 | redirects to                      |
+---------------------------------+-----------------------------------+
| eric@example.com                | eric@gmail.com                    |
| justine@example.net             | justine@gmail.com                 |
+---------------------------------+-----------------------------------+
2 rows in set (0.00 sec)
 
Last edited:
I was able to leverage more of Shall's code to find the answer:

Code:
mysql> SELECT CONCAT(mail.mail_name,'@',domains.name) AS 'virtual mailbox', mail_redir.address AS 'redirects to' FROM mail_redir,mail,domains WHERE mail_redir.mn_id = mail.id AND mail.dom_id = domains.id AND mail.redirect = true ;
+---------------------------------+-----------------------------------+
| virtual mailbox                 | redirects to                      |
+---------------------------------+-----------------------------------+
| eric@example.com                | eric@gmail.com                    |
| justine@example.net             | justine@gmail.com                 |
+---------------------------------+-----------------------------------+
2 rows in set (0.00 sec)

FYI: I discovered that the last condition (i.e., "AND mail.redirect = true ;") didn't do anything for paring down the results so I modified the search term by enclosing the word true in quotes and got very different results:
Code:
mysql> SELECT mail.mail_name FROM mail WHERE mail.redirect =  'true';
Empty set (0.00 sec)

mysql> SELECT CONCAT(mail.mail_name,'@',domains.name) AS 'virtual mailbox' , mail.redirect AS 'enabled?' FROM mail_redir,mail,domains WHERE mail.redirect = 'true' ;
Empty set (0.00 sec)
 
Back
Top