Closed edbond closed 10 years ago
Seems like doing this only at compilation time is a bit inflexible. What if you have a servlet running and you change MTAs? You don't want to have to restart it. The cost of performing the lookups is very low. If we had a measurable perf hit (thousands of docs/sec, eg) we could cache it for a few minutes or something. Most people probably don't use postal for performance. :grin:
this is embarassing, do you think lookup several files for EVERY! email sent is not a performance hit? If you care about changing MTA then add an atom and a function to set it once at start. If someone needs to update MTA they will call initialize function. I used postal to send many emails using agents to test custom MTA load and throughput. It's a pity a good library has such big flaw. Maybe you should add a sleep for some seconds for every email?
I think you misunderstood my comment. It's absolutely a performance hit, but is it a meaningful one? Java can do 7 (seven!) file checks pretty fast.
If you're still not satisfied, we can certainly solve it. I mentioned one approach that you didn't respond to. We're not going to solve it with recompiling, mutating an atom, or, really, requiring the user to do anything, which is why I rejected the PR.
Don't loop through all sendmail variants, find only once. Also it would be nice to give a warning if sendmail not found but I don't know how to do it better, (prn) looks doesn't good to me. If sendmail not installed NPE from ProcessBuilder is thrown, see http://pastebin.com/C8fcXwA2