Closed suquant closed 12 years ago
Hi,
The problem is that Haraka will look up the MX records for your domain and deliver the mail there, thereby creating a loop as Haraka won't know that it's talking to itself.
What you need to do is to create a plugin that overrides the MX record for your domain and routes the message to the desired internal host.
Create a file called override_mx.js in your plugin directory and add the following:
exports.hook_get_mx = function (next, hmail, domain) { if (domain.toLowerCase() === 'my.domain.com') { return next(OK, 'internal.hostname.com'); } return next(); }
Change 'my.domain.com' to your domain name and 'internal.hostname.com' to a hostname that resolves to the IP address of your server (it MUST be a hostname that is resolvable in DNS due to the way this function works currently).
Then add 'override_mx' into config/plugins, restart Haraka and send yourself a test mail - it should work correctly now.
Hope that helps.
Thank you Steve Freegard :-)
I try this in the near future and will answer here after the experiment.
We have also added in a check on maximum number of Received headers to Haraka to prevent this from being an infinite loop.
Example: We have 1 smtp server (mxs.example.com) Situation: We send mail from mxs.example.com to -> mxs.example.com
This situation Haraka recursion send self this message indefinitely!!! What i do wrong?
My config:
connection.relaying = 1
root@mxs:~# node -v v0.6.5
root@mxs:~# haraka -v Haraka.js — Version: 1.0.2