How to forward email to Gmail BUT filter out spam first?

Gmail have recently started filtering “spam” before it arrives to a users mailbox. The user has no chance to read it, nor mark it as not spam or whitelist the user even. This is a HUGE issue in my opinion, GMail is now blocking a LOT of legitimate email from our mail server and the recipients cannot see the “spam” email nor whitelist the user. We have no control over it.

One reason I think this may be happening is we have Aliases to forward email to our users to Gmail. This means spam email will be forwarded to Gmail. I have a hunch Gmail is marking our server as a server than is forwarding spam to it.

What I would like to do is filter spam using spamassassin BEFORE it is forwarded to Gmail. I guess I should not use an Alias but instead use an email account, but what I do not know is will spamassassin filter the email first by default, and forward only legit email, OR do I have to do something else like create some rule.


I founds this thread which implied forwarding needs to be setup in Usermin and not Virtualmin (I guess because that creates a user filter after spam filter):

This thread asked same question with no answer…

So I will try the usermin filter see if that works.


I know this is a bit of an old thread but I’m trying to achieve the same thing and was wondering if you managed to do it with Usermin? The ‘Mail Forwarding and Replies’ section looks like it only works for the logged-in user whereas I’ve got 50 or more forwarders set up and would rather not create accounts for each if I can help it.

Alternatively, does anyone else have any ideas?



Nope! Never figured out how to do it. So we had to stop using Gmail because it was filtering out legitimate messages too often and not putting them into our spam folder. Filtering them out even before then.

Because of this issue i can only HIGHLY recommend people stop using GMail, as they could be filtering legitimate message and you will never know.

So we just host our own email accounts in Virtualmin now, and to be honest its much better, I have far more control.

Virtualmin spam processing needs improvement though… not just for this, but if I setup an autoresponder, it responds to all the spam messages too! Go figure.

Hey, thanks for replying. That’s a shame - I thought I might be on to something :frowning:

We’ve got lots of users on all different mail providers so it’s not just Gmail, but I have kinda the reverse problem in that I’m getting complaints of too much spam getting through. In theory, Gmail, Hotmail, etc. should be filtering it themselves but I’m concerned that my server will get blacklisted.

I was thinking about installing Mailscanner as I’ve found it to be quite effective but I don’t know if that will help. Anyone know?




It should actually be as simple as setting up the forwarding from Usermin, rather than Virtualmin.

Or, you could simply manually add a .procmailrc or .forward file that handles all that.

If that isn’t working, what issue is it that you’re seeing when attempting that?



To do that though would I need to set up accounts for each address that I want to forward, then log in to Usermin and set up the forward?

Regarding the second option, would you be able to elaborate or point me in the right direction please as I’ve not got much experience configuring Procmail.

Many thanks,



What you described is correct.

Spam and virus filtering occur during the email delivery process. So for either of the above options to work, an email account would need to exist on the server.

Do you have a lot of addresses you’re hoping to forward?


“but I’m concerned that my server will get blacklisted.”
This is why we stopped using Gmail. I think our server was blacklisted because of the increase in legitimate emails being blocked.

“We’ve got lots of users on all different mail providers so it’s not just Gmail,”
Yes, Microsoft also block emails before sending it to the users spam/inbox folders, and reply to the sender telling them their email was not delivered.

I used to recommend Gmail and other free accounts, but now they do this I’ve done a complete u-turn and advise people not use them if they want to make sure they get all their email!

Hi Eric,

Yes, over 50 for one particular account, so whilst it’s not impossible it’d take a while. Do you know if using Mailscanner would help?

Amityweb - to be fair I think in normal circumstances (ie. when not forwarding mail to it), Gmail works well. It’s understandable that for any mail service, receiving a lot of spam from one location is likely to result in blacklisting but it’s a shame that it seems the intermediate server gets the blame.



HI Martin. The problem is we cant control the senders server reputation. So its not really anything to do with us or forwarding of our email. So Google could in fact be blocking emails sent to you from anyone else that may be forwarding spam to it. For example, a sales enquiry. You wont know its been blocked. The sender will, but then maybe they’ll just not bother picking up the phone to tell you, especially as your competitor has already contacted them :slight_smile: