haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.02k stars 662 forks source link

Relay emails from haraka to an SMTP server #233

Closed vikas-silverlineit closed 11 years ago

vikas-silverlineit commented 12 years ago

I am using haraka for sending mails.

Now, I don't want to send mails directly from haraka. I want to relay all emails from haraka to another SMTP server and then that SMTP server will send those mails.

I can't find any relay plugin/feature for this purpose. Is there any possible way to do this in haraka ?

Thanks & Regards

smfreegard commented 12 years ago

You should be able to do this easily by making a small change to the smtp_forward plugin. Copy /usr/lib/node_modules/Haraka/plugins/smtp_forward.js to your plugins directory and then edit it and add the following to the end of the file:

exports.hook_queue_outbound = exports.hook_queue;

Then edit config/smtp_forward.ini and set host/port to the SMTP server that you want Haraka to forward everything to.

baudehlo commented 11 years ago

A better way, rather than modifying a plugin (and thus potentially getting out of date) is to create a get_mx hook plugin that returns the SMTP server you want to forward to. I should probably ship one in core at some point to do this.

Closing this bug.

whoisharris commented 11 years ago

I have the same question that 'vikas-silverlineit' had. It does not look like one of these has been shipped in core at this point. Was there a get_mx hook plugin created that returns the SMTP server to whom you need to forward? Thanks in advance for guidance and apologies for bringing this issue back to life.

baudehlo commented 11 years ago

There isn't one in core per-se, but here's how you do it in a plugin:

// relay all outbound mail through localhost on port 2525
exports.hook_get_mx = function (next, mail) {
    next(OK, "127.0.0.1:2525");
}
elbuo8 commented 10 years ago

Did this ever made it to core? @baudehlo

baudehlo commented 10 years ago

Yes: http://haraka.github.io/manual/plugins/relay.html