views:

31

answers:

1

I need to create something like mail daemon on java or node.js We have a highload project written on PHP which generates a lot of e-mail registrations/updates/etc. Currently all messages are being put into mongodb after processing (language/template). I'm considering writing a small daemon which will check for new messages in mongo every second and send them out.

I'm a little new to Java or node.js and don't want to create another bicycle. Can someone point me to the right lib or something like that?

PS: It should be fast, async and standalone.

+1  A: 

I would recommend setting up a SMTP-server locally, and just have the PHP project send the mails directly to that SMTP-server as they are generated. This is the exact scenario that such servers are optimized for.

Either you can install a native one or Apache James (which is written in Java). I can recommend postfix which is standard with Ubuntu and easy to setup. I do not have personal experience with Apache James, but it appears to be a complete server solution for low to medium sites.

Thorbjørn Ravn Andersen
I answered in a comment above. We can not wait reply from MTA. I mean i don't want to create another MTA on Java, I just want to write threaded daemon to check Mongo and send out email with sendmail for example, or uses Commons Email... I want to know should I use GC, threads or event like daemon, what suits best Java or node.js?
nateless
Email delivery happens _after_, not while, you stuff it in the MTA. Postfix or sendmail behave the same in that regard.
Thorbjørn Ravn Andersen