Return-Path for ActionMailer

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

h3. 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.

h3. The Problem

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

h3. The Solution

* Use sendmail to deliver emails.
* Create your own @perform_delivery_sendmail@ method

h3. 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 [email protected]","w+") do |sm|
       sm.print(mail.encoded.gsub(/\r/, ''))
       sm.flush
      end
    end
 
  ...

h3. 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.

Free Hugs

Came across this on you tube today. I am so much a “Feel Good’ movie junkie!

“YouTube”:http://www.youtube.com is Google’s newest plaything!

Speed Reading

I have always believed that the ability to speed read is critical to success … the importance of keeping up-to-date with emerging thoughts and trends can never be understated.

During my time as a student, I trained myself to speed read, and recall that, with a young brain, I could read at well over 1,000 words per minute with near perfect comprehension.

However, I the bulk of my reading these days is of the electronic type and I had become aware that my reading skills of the “dead tree” variety were somewhat rusty.

Last week I was introduced to an Speed Reading Audio Course which both confirmed that my reading skills were distinctly waning, and reversed the trend in just a few minutes!

You can find out more, and buy the course, from my new site “SpeedRead4Results.com”:http://speedread4results.com

Australia Tibet Council

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”:http://www.atc.org.au 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”:https://www.atc.org.au/members/ to this worthy cause.

A hostile network like the wild west without a sheriff!

I am constantly amazed at the difficulty I have convincing clients/friends and others that connecting a PC to the internet is one of the most dangerous modern activities.

It seems that the most prevalent attitude is *yes, but it won’t happen to me*.

Well, the truth of the matter is *it can, it will … and it probably already has!*

Here’s a quote from a recent report on “A Current Affair”:http://aca.ninemsn.com.au/article.aspx?id=127021

bq. Michael Roggenkamp is proof it can happen to anyone – he’s an academic specialising in information technology who had over $20,000 stolen from his savings account.

This, and hundreds of thousand more, was stolen with the help of a “trojan virus”, a simple software program that installs itself on your PC, collects your passwords, and sends them to the *bad guys* who then rob you blind. In this case, they were pretty greedy, emptying bank accounts over a few days. If they, the Bad Guys that is, were a bit more patient, they could probably skim funds from many accounts over periods of months or even years!

Anyway, take note of the title *The Internet is a hostile network like the wild west without a sheriff !* which is the by-line of “http://www.firewallguide.com/”:http://www.firewallguide.com/

Check it out, and make a genuine assessment of the risk that you face each time you fire up Internet Explorer.

Rails testing with sqlite

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

h3. 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)

h3. 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.

h3. The solution

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

New Hosted Application

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.

Never be caught short again

Did you know that some part of your taxes are spent by our Government on maintaining a “National Public Toilet Map”:http://www.toiletmap.gov.au/default.aspx?

Yep, sure is, just click on the link and before you can cross your legs you’ll have a full color map marking the location of the nearest public toilet!

The site proudly announces that it is “A project of the National Continence Management Strategy”:http://www.health.gov.au/internet/wcms/Publishing.nsf/Content/Continence-2 which has its own web site! No doubt these two fascinating sites help our bureaucrats spend the $4.5 million dollars per year that is allocated to this “Strategy”.

!{float:left; padding: 0 10px 0 0}http://nigelball.org/files/toilets.gif! Catering to the hi-tech enabled grannies (never leave home without your Blueberry to locate the nearest “loo”) has been taken to the extreme. Granny can quickly transfer her latitude and longitude from her GPS to her Blueberry to find her nearby relief.

Better still, the organised traveller can use this invaluable site to plan a trip by joining the public toilet dots between here and there!

For the record, at last count there were 3,210 public toilets in Victoria, and as the picture shows, I am lucky enough to have a unisex (long live Ally McBeal) toilet just 612 metres South West of my home.

I’m just dying to register with the site so that I can plan a tour of Greater Melbourne with the guarantee that I’ll never be more than 15 minutes away from the next toilet stop!

Happy travelling campers..