I'd like to setup an Haraka mail server on a domain (let's say 'example.com') that will only act as a forwarding service to a 'gmail.com' email address. For the sake of the example let's say I'd like all emails sent to 'me@example.com' to be forwarded to 'me@gmail.com'.

I've already partially succeeded in setting this up using the 'rcpt_to.alias_forward' plugin. Sending the mail using the server itself works, but sending it from gmail still doesn't work. The logs indicate that the message is forwarded in successfully, but it never arrives at the forwarding address.

  • 1
    sending it from gmail still doesn't work. The logs indicate that the message is forwarded in successfully, but it never arrives at the forwarding address. The first statement is about sending mails from gmail, the second one about receiving mails to be forwarded. Could you please clarify your setup and include examples, configuration and logs. – sebix Feb 19 '15 at 8:52

What you need to do is first setup aliasing that address. You can do this with the aliases plugin (or the plugin you listed in your question). See the documentation here: http://haraka.github.io/manual/plugins/aliases.html (and add the plugin to config/plugins).

Secondly you need to set things up to relay everything outbound, since you want everything to go to this one address. You can do this with the relay plugin by setting the all=true option: http://haraka.github.io/manual/plugins/relay.html - but note how it says not to use that in production, so read the next section carefully:

Finally you need to make sure you don't relay mail that isn't for the known recipients. You do this with the access plugin. Just blacklist every email address, and whitelist the ones you want to allow. http://haraka.github.io/manual/plugins/access.html

Be careful with this setup. You can all too easily setup an open relay. If you get stuck, you can get real-time help on the #haraka IRC channel on Freenode, or use the Haraka mailing list.

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!

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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