I had the same problem, and I solved it by installing haraka-alias-forward plugin:
https://github.com/chadsmith/haraka-alias-forward/blob/master/config/rcpt_to.alias_forward
If you have Haraka installed already then:
- copy the rcpt_to.alias_forward.js file to the plugins folder
- copy the rcpt_to.alias_forward file to the config folder
If you start with Haraka from scratch, then:
git clone https://github.com/haraka/Haraka.git
cd Haraka
git clone https://github.com/chadsmith/haraka-alias-forward
haraka -i <where you want to install Haraka>
Enable the plugin in the config/plugins file:
# RCPT TO
# At least one rcpt_to plugin is REQUIRED for inbound email. The simplest
# plugin is in_host_list, see 'haraka -h rcpt_to.in_host_list' to configure.
#rcpt_to.in_host_list
#rcpt_to.qmail_deliverable
#rcpt_to.ldap
#rcpt_to.routes
rcpt_to.alias_forward
Don't forget to update the rcpt_to.alias_forward config file with your rules.
{
"example.com": {
"me@example.com": ["me@gmail.com"]
}
}
If you want all emails sent to your domain to be forwarded to your Gmail account, use this config:
{
"example.com": {
"*": ["me@gmail.com"]
}
}
Oh, one more thing. If you use the latest version of Haraka, you'll get an error when Haraka starts if haraka-alias-forward plugin is enabled.
Change rcpt_to.alias_forward.js file as follows:
from:
Address = require('./address').Address
to:
Address = require('address-rfc2821').Address;
You'll need to restart Haraka for these changes to take effect.
This worked for me. Good luck!