I would like to create a system in which anyone can hook up their email, and have all emails that come to them go through my server first. Anyone who signs up for this service, will have their email vetted by my servers filtration system. If it passes through the filters, I'd like to forward that email onto their inbox.

  • Vetted for what? Jun 14, 2013 at 10:02
  • let's say for specific words. It doesn't really matter. Any script.
    – bzupnick
    Jun 14, 2013 at 10:10
  • So...a spamfilter?
    – Nathan C
    Jun 14, 2013 at 11:01
  • 3
    Please elaborate on the question. You are receiving many answers that may be unsuitable for your exact use case. Do you want to only support email users of your domain, or do you want anyone to be able to use your service with their existing email account? Do you want to support places like gmail/hotmail/etc like you mentioned in your original post? If so, do you want them to keep their address, or are you providing a proxy address i.e theiruser@yourdomain.com forwards to theiruser@theirdomain.com after being vetted. Please clarify Jun 14, 2013 at 11:24

4 Answers 4


The vetting part will be quite simple. The difficult part will be ensuring that the user's email passes through your server first. This will either require the users installing some sort of software on their system to intercept the mail coming from their mailboxes, or it will require the users changing their email to a domain you host (maybe a subdomain of their primary domain delegated to you?) or it will require the admins of the mail systems forwarding mail to you when it arrives for your subscribed users.

None of these things are easy, simple to implement, or foolproof.

  • 1
    +1 for reading between the lines, I am fairly certain OP is looking for a solution that is nearly impossible without a custom client-side configuration like you said. Jun 14, 2013 at 11:29
  • Yeah, if he was talking about entire domains, I think Rob's answer would be the best. Somehow, I get the impression he isn't though.
    – NickW
    Jun 14, 2013 at 11:30
  • I apologize for my vague question but, you gave a perfect answer. Thanks!
    – bzupnick
    Jun 14, 2013 at 12:18

in the gmail settings you can add forward addresses and delete the original mail in the gmail inbox. forward the mail to a mailaddress on your server. on your server install the filters (spam, virus, content) you want.

  • I'm looking for a more universal answer. Not only Gmail.
    – bzupnick
    Jun 14, 2013 at 9:19
  • please put more detail in your question then you will get a more detailed and maybe a universal answer Jun 14, 2013 at 9:45
  • I am not sure why this answer was downvoted. This is the ONLY answer so far that has offered a solution to the original question. The question specifically asks how you can intercept and filter email heading to Gmail.com. If you want to know how to do it through a domain you own and control, the answer is going to be MUCH different than asking how to do it with an existing service like gmail/yahoo/etc. Jun 14, 2013 at 11:19

Have a look at the script handlers in postfix (or exim), and Procmail. I did a quick google search for 'postfix script filtering' and found this article about spam filtering based on content, using procmail.

Should be possible to do given your own wordlist. I know Exim has similar feature sets.


This is perfectly possible. There are plenty of services out there that make a business out of doing it. The difficult bit is not in configuring their email servers to send email via you, or configuring your servers to accept, and then forward their email but instead in producing useful filters that can't be done "locally" to the sending servers and therefore making it worth your and their effort.

You're effectively acting as a smarthost for the users - instead of publishing MX records to the net and sending email from their own servers, they publish your server(s) as the MX record for their incoming email and forward all their outgoing email to you from their edge SMTP server.

It's not exactly a difficult configuration on any reasonable email server.

  • 1
    If the entire domain is assigned to you, yes, if it's per email signup it's nowhere as simple.
    – NickW
    Jun 14, 2013 at 11:22
  • 1
    Exactly, its not going to be easy to get Google to modify their MX records to point to your personal spamfilter box Jun 14, 2013 at 11:28
  • This is true - Due to the lack of detail we're all having to make assumptions. That's down to the OP to clarify, and even if some or all of our various assumptions are wrong they might still help the OP clarify their thoughts. To somewhat echo the comments by @NickW on his question, between the two of us we have covered the bases I think, but it all depends what exactly the OP is after.
    – Rob Moir
    Jun 14, 2013 at 11:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.