Using sendmail on OS X 10.8
This afternoon I was trying to deploy out jruby project to UAT, and I got the following error:
sendmail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory
and I was immediately saddened by the development. What's happening is yet another of the rubyists shortcuts and magic gems - they wanted to have emailing from within ruby, and rather than make sure there's a decent, workable, SMTP gem - which there has to be, or there should be because of how easy it is to write, they went with the first thing they saw, and it uses sendmail.
Now I don't have anything against sendmail, but it's the completely wrong tool for the job. They have had to put in a user's name - so all emails seem to come from one person, as opposed to the person doing the activity. It's just a piece of junk, and for good reason - it's the wrong tool for the job!
But I have to make my laptop work with this. It's not running by default, and the reason is that it's the wrong tool for the job, but that's something I'll take up with them another day. Thankfully, we have a solution:
sudo mkdir -p /Library/Server/Mail/Data/spool sudo gzip /usr/share/man/man1/{postalias.1,postcat.1,postconf.1,postdrop.1, \ postfix.1,postkick.1,postlock.1,postlog.1,postmap.1,postmulti.1, \ postqueue.1,postsuper.1,sendmail.1} sudo gzip /usr/share/man/man5/{access.5,aliases.5,bounce.5,canonical.5, \ cidr_table.5,generic.5,header_checks.5,ldap_table.5,master.5, \ mysql_table.5,nisplus_table.5,pcre_table.5,pgsql_table.5,postconf.5, \ postfix-wrapper.5,regexp_table.5,relocated.5,tcp_table.5,transport.5, \ virtual.5} sudo gzip /usr/share/man/man8/{anvil.8,bounce.8,cleanup.8,discard.8,error.8, \ flush.8,local.8,master.8,oqmgr.8,pickup.8,pipe.8,proxymap.8,qmgr.8, \ qmqpd.8,scache.8,showq.8,smtp.8,smtpd.8,spawn.8,tlsmgr.8, \ trivial-rewrite.8,verify.8,virtual.8} sudo /usr/sbin/postfix set-permissions sudo chmod 700 /Library/Server/Mail/Data/mat sudo /usr/sbin/postfix start
and with these changes, the system has sendmail running, and the gem works.
I can't think of a more completely wrong solution to the problem, but these guys aren't about the "right" answers - they're about the "magic" ones. They want to just drop a gem into a Gemfile, bundle it, and then have it do all the magic. They'll give it a bunch of configuration, and rather than question the use of such a gem, they'll just completely contort the project to the point that it fits the usage of the unappropriate gem.
It's bizarro programming.
I hate it. I really do.
UPDATE: Funny developments… the gem we're using is called Pony, and can use SMTP or sendmail, you just have to configure it differently. Also, it turns out that sendmail is the preferred way to send emails at The Shop. Kinda odd to me… to put sendmail on all hosts to be able to send simple emails, but OK… I'm a "team player", I'll back off. But what a waste of cycles - there are so much easier ways to do this same thing. Even if we keep the same gem.