I got it working in Insoshi with a migration like this:
class SmtpAuthenticationPreferences < ActiveRecord::Migration
def self.up
add_column :preferences, :smtp_user_name, :string
add_column :preferences, :smtp_password, :string
end
def self.down
remove_column :preferences, :smtp_user_name
remove_column :preferences, :smtp_password
end
end
And editing config/initializers/email_settings.rb like so:
begin
unless test?
global_prefs = Preference.find(:first)
if global_prefs.email_notifications?
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => global_prefs.smtp_server,
:port => 25,
:domain => global_prefs.domain,
:user_name => global_prefs.smtp_user_name,
:password => global_prefs.smtp_password,
:authentication => :login
}
end
end
rescue
# Rescue from the error raised upon first migrating
# (needed to bootstrap the preferences).
nil
end