Outbound Mail Delivery

For the past few evenings I’ve been working on outbound mail delivery for Haraka. Basically pouring over RFC 5321 to get everything working according to that plan.

So there’s now a queue/deliver plugin which will queue the mail into the queue directory, and attempt to deliver the mail to its relevant MX host. (Note: this is for outbound mail). It supports exponential back-off if there’s a temporary failure, and should handle MX lookups correctly as far as I can tell. It correctly generates bounce messages when those are required, and it will re-scan the queue upon restart should something fail.

There’s a few features I’ve yet to implement, for example if you try and send a mail to hundreds of recipients at a single domain, and the ongoing mail server doesn’t like that (some hosts have a configured maximum), right now it doesn’t deal with that. Though it probably should re-split the mail smartly.

I think it should scale well to lots of connections and mails, though it doesn’t scale right now across CPUs (if you use “cluster”). That’s only because re-reading the queue expects just a single thread as you can’t scale a readdir across multiple processes. I have a thought of how to get around that (by only re-reading the queue in the master process if running under cluster – that will still work across multiple processes until you restart the server). But I’m not sure if that’s the best solution. But probably better than breaking completely.

Anyway, it’s in github. You know where to get it :) You just need a plugin which sets connection.relaying = 1 (presumably a rcpt or auth plugin of some kind) and then have the deliver plugin instead of qmail-queue or an smtp proxy, and you’re good to go.


One thought on “Outbound Mail Delivery

  1. Simon says:

    Exciting stuff. I would love to see Node apps start to take the place of mainstream communication tools. Keep up the good work and keep us posted!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s