haraka / Haraka

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

Outbound alias #963

Closed DaAwesomeP closed 9 years ago

DaAwesomeP commented 9 years ago

I am trying to forward email with aliases. How can I do this with Haraka and not another SMTP server? I noticed that the smtp_forward plugin in trying to connect to another server and not use itself as the server. I want Haraka to only accept email at its own domain and then forward those emails to other addresses on the internet based on the alias configuration. I do not want users to actually be able to log in to the server. Is this possible?

DaAwesomeP commented 9 years ago

@smfreegard I know that it can be done, but how? I can't quite find the right info in the docs.

smfreegard commented 9 years ago

Create a queue plugin that does this:

exports.hook_queue = function (next, connection) {
    var transaction = connection.transaction;
    outbound.send_email(connection.transaction, function(retval, msg) {
        switch(retval) {
            case constants.ok:
                return next(OK, msg);
                break;
            case constants.deny:
                return next(DENY, msg);
                break;
            default:
                return next(DENYSOFT, msg);
        }
    });
}

Then any recipient that you accept in hook_rcpt will use outbound for delivery.