ar_mailer gem forked on GitHub, goodies added
Now that GitHub has a gem server it allows the process of managing your own fork or customisation of a gem ridiculously easy. No need for your own gem server or shipping around gem files, just put it up on github and nominate it as a gem in the project config. GitHub will automatically compile the gems using a gemspec file if present. All the info you need is here so I won’t recap it any further.
A gem which I find essential for Rails apps which send out emails is ar_mailer by Eric Hodel of Seattle Ruby Brigade and Ruby Hitsquad fame and now the maintainer of RubyGems. But there a couple of things missing. One is the need for pid files to be generated when running as a daemon to allow effective management with monitoring tools and such.
Well there just so happened to be a patch by Dylan Egan in the ar_mailer forums to add this feature, but it has been overlooked for a long time. So I thought this would be a good chance to fork it and use the GitHub gem system as well. Its now forked it and patched with some tweaks to get it working and a few fixes for the tests which broke due to changes in the latest ZenTest gem.
The project for the gem is here. To use the new gem you need to remove the old one because of the way github names your gems. It uses github username as a prefix to the gem name. This means the old gem will be loaded instead of the new gem when required in your app. But the binary will be used from the new gem causing nasty problems.
To install, first add GitHub as a gem source
sudo gem sources -a http://gems.github.com
Then
sudo gem install adzap-ar_mailer
Now when the binary is run in daemon mode you will get the pid file you need. You can specify the pid file location in the command options like so
ar_sendmail -d -p ./log/ar_sendmail.pid
Any relative paths are expanded from the app directory. You can of course use an absolute path if you wish. The file gets removed on exit as you would expect.
The other major addition is not as visible. Its a Ruby based init.d script for managing mailer startup for one or more apps. It uses a yaml based config file where you specify the app settings for each app that needs a mailer instance running. See the README and demo config for more info.
Ruby, my hammer, is starting to make everything look a nail!
Remember this is GitHub, don’t like what I have done, then fork off!
UPDATE:
If you are getting an error running the ar_sendmail binary, this is due to GitHub to setting the permission on gem binary files incorrectly. The error would be
/usr/bin/ar_sendmail:19:in `load': no such file to load -- ar_sendmail (LoadError) from /usr/bin/ar_sendmail:19
To fix it you need to run this ugly (please let me know a better way to get a gem path!!)
GEMS_PATH=`gem env path` GEM_NAME='adzap-ar_mailer' sudo chmod 755 $GEMS_PATH/gems/$GEM_NAME*/bin/*
Now you should be able to execute it as a normal user.
UPDATE 2:
Fixed the update fix and made it version non-specific
UPDATE 3:
GitHub fixed the file permissions issue so the work around is not needed anymore.
23 Comments so far
Leave a reply

My company has wrestled with ar_mailer in the past and it has mostly satisfied our needs, but we figured there had to be a better way.
Mass mailing in rails has always been a pain in the ass, so why not cut it out of the app and have a dedicated process for it?
We took a stab at making this kind of solution, take a look: http://blog.twg.ca/2009/09/rails-mass-mailing-it-shouldnt-be-this-complicated
Would love to get your feedback on the idea.
my favorite gemstone is none other than diamond. the most expensive and priceless gemstone ever.*~~
Diamonds and Rubys are my favorite gemstones, i like the color red and the sparkle of diamond.*,`
the best gemstones would be diamond and topaz, red rubies are great too`,;
the best and ultimate gemstone is of course diamond because it sparkles and very expensive’:*
Pretty nice post. I just stumbled upon your blog and wanted to say that I have really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!
gemstones are expensive but when you give a ring with gemstone to your girlfriend, she would really like it ;*”
~~~ I am very thankful to this topic because it really gives up to date information ‘–
*;~ thank you for posting a topic about this stuff, i was looking for it. ;-*
Pretty section of content. I just stumbled upon your weblog and in accession capital to assert that I acquire in fact enjoyed account your blog posts. Any way I will be subscribing to your feeds and even I achievement you access consistently fast.
What a nice website. I absolutely admire your Page about Stethoskop und Belkin Router! http://www.opernundkulturreisen.de/?path=guestbook Stethoskop und Belkin Router
Very interesting information!Perfect just what I was looking for!
I really like your wordpress web template, exactly where would you obtain it from?
Details your post. This method study pastimes everybody considerably along with as a result of you, When i acquired different matters. It absolutely was very worthwhile. Site. Bravo. You reside.
Whoa – nice short post, Does any one know R there cheaper SMS message marketing services 4 shops @ California than 12stores.com? They only cost $9 / 30 days, but my friend Collin said me there is, unfortunately he could not recall its name. I actually start to get suspicion that he remembered wrongly.
Just about all of what you articulate is astonishingly precise and that makes me wonder the reason why I had not looked at this in this light previously. Your article truly did switch the light on for me personally as far as this subject matter goes. Nonetheless there is 1 point I am not too comfy with and while I attempt to reconcile that with the actual central idea of the position, permit me see what the rest of your subscribers have to point out.Nicely done.
27. Wow, wonderful blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is excellent, as well as the content!
Excellent site, keep up the good work my colleagues would love this.
I recently wouldn’t depart your internet site earlier than indicating i really enjoyed the common details any person contribute towards your wedding guests? Is certainly usually yet again constantly in an effort to research crosscheck fresh threads
Hello my family member! I wish to say that this post is amazing, nice written and come with approximately all vital infos. Iˇ¦d like to look more posts like this .
For a few people, there’s nothing better than spending time with the cooking developing cooking treats for the whole family members. The only real part that will is apparently a negative may be the mess that is certainly left later on! Thank goodness, you don’t need to being section of the clutter, as possible don cooking aprons to help keep your self clear. Cooking aprons are available in many styles as well as slashes, so you will have no problem discovering engineered to be the two flattering and also functional; you simply need to understand best places to search.
English I own feeblly, but regularly I read you with the help online the translator from google. Thanks for interesting posts
Just about every day good-looking girls get approached by guys who want them for sex. Most of these guys are not very good looking which is not the most important thing in the…