Set filter to forward to another email and still deliver to user mailbox?

I am in Usermin for a user account and want to create a filter that forwards an email if it is from a specific sender, but I also want it to still be delivered to the intended, original mailbox. It appears this is not possible from within Usermin. My choices are ’ Deliver to Inbox’ or ‘Forward to addresses’, but not both. I have tested just forwarding an it only forwards but does not deliver to the original recipient. Does anybody have a solution?

I guess no solution? For now I have an email client filtering and doing the forwarding. Annoying.

The mail filtering isn’t Virtualmin’s strongest point. I’ve been diddling around with it in the shell trying to come up with something more full-featured for my own use, but not getting very far. It seems to use Procmail, but none of the config files or recipes are where I’d expect them to be.

I haven’t had a chance to try it, but putting both addresses in the forward field separated by a comma (no spaces) might work.


The last time I did anything manually in Procmail was the same week the wheel was invented, but as I recall that was all you had to do to send to multiple addresses. Whether it will work with Virtualmin’s filter GUI, I haven’t tried, so I don’t know. I’ll test it after supper.


Okay, that doesn’t work. It creates a loop error in Postfix.


Yeah that’s why I didn’t even try that. Thanks for giving it a shot though.

If it’s a Postfix thing, then what we need is the ability to execute a script as an action.

I coded one in PHP on another server that did exactly what you want to do, although that was just a requirement rather than the reason. Creating it from a script should avoid the error by remailing it from a different address like “robot@server.domain.tld” or something along those lines.

I wrote about it in this thread.


I didn’t bother to see if this option really does not exist in Usermin since I don’t use it, but it’s easily achieved from Virtualmin under the ‘Edit users’ -> ‘Mail forwarding settings’.

But that’s not conditional. What OP wants to do is only forward to another address when a condition is met, but also process the mail to the user’s inbox even when that condition is met.


Wops, didn’t see that part… Nevermind me then.


There’s a “Procmail mail filter” module for Usermin that you can enable in Webmin > Webmin > Usermin Configuration > Available Modules.

The module will be accessible in Usermin > Usermin Tab > Mail > Procmail mail filter and provides finer control of the filters, plus manual editing, on a per-use basis. Woo hoo!

To make it forward plus deliver, all you have to do is define the conditions, set the forwarding address, and check the box for “Continue processing even if conditions match.” The mail will be forwarded, and it will also be delivered to the user’s mailbox.

Life is good.



This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.