Small Business Resources

I spend the better part of my time advising Small Business on the ins and outs of Online Marketing. Pop over to eBiz4Results.com for the full story.

Current Project

At the end of 2008, I launched BestMacTools.com where you will find reviews, and commentary mostly related to Productivity Tools for Mac OS X.

For Bloggers

It is now just about axiomatic... the most effective online marketing tool for any business is a Blog. That's why I publish Blog4Results.com.

Archive for Ruby on Rails

Having spent several hours trying to get this to work, thought I’d share it with the world!

The Goal

When sending emails from an automated service like RSS:Forward it is common to want the return-path and the reply-to headers to be different.

This lets the receiver of the email reply to the author of the email while bounces are returned to another address which, presumably, updates the list database to ensure that bad email addresses are automatically removed from the list.

The Problem

Ruby on Rails does not support setting the return path when sending emails using ActionMailer

The Solution

  • Use sendmail to deliver emails.
  • Create your own perform_delivery_sendmail method

The Details

Make sure that you configure ActionMailer to use sendmail by adding the following line to your config/environment.rb file.

  config.action_mailer.delivery_method = :sendmail

Add to the top of your Mailer model so it looks like this…

  class SubscriptionMailer < ActionMailer::Base
 
    def perform_delivery_sendmail(mail)
      IO.popen("/usr/sbin/sendmail -i -t -fno-reply@your.domain.com","w+") do |sm|
       sm.print(mail.encoded.gsub(/\r/, ''))
       sm.flush
      end
    end
 
  ...

The Fine Print

This will presumably not work on the MS legacy operating system.

Use the code at your own risk … it works for me

If you have a better solution, please let me know.

fter much development, review and some false starts, a new web site has been launched with my assistance. It is for the Australia Tibet Council a not-for-profit organisation campaigning for a Free Tibet.

The site covers an interesting range of services for its readership, and for members of the organisation…

  • an information portal
  • a place to purchace Tibet related merchandise
  • an email campaign manager for guided lobbying
  • online donation and subscription management
  • online mailing list manager

I make no claims regarding the content of the site (that is all the work of the excellent executive staff and their helpers), but I am rather pleased with my contribution to the look of the site and the range of services that are provided.

For the record, the site is based on…

  • Joomla for the portal elements
  • Virtuemart (a Joomla plugin) for the merchantising component
  • phpList for the email list management
  • subscription management by a ruby on rails application developed by me

BTW, you should seriously consider making a donation to this worthy cause.

Just a quick note with an answer to an issue which has been bugging me for days.

The problem

Tests run OK within Eclipse but fail miserably from the command line with an error like…

Started
...E
../lib/sqlite3/errors.rb:94:in `check': cannot rollback - no transaction is active (SQLite3::SQLException)

The diagnosis

It seems that the test runner automatically loads fixtures even if not asked to do so. The template fixture files contain stubs for test records which cause sqlite3 to choke.

The solution

Just make sure that fixture files actually contain real fixtures that are needed for your testing!

Over the last couple of months I have been diligently working on a new Hosted Application, RSS:Forward. The application finally reached sufficient maturity last night to be exposed to the world! This process makes having a baby look easy…

Anyway, promotion of the service will start over the next couple of weeks, so keep listening.