class Mail::FileDelivery

def deliver!(mail)

def deliver!(mail)
  envelope = Mail::SmtpEnvelope.new(mail)
  if ::File.respond_to?(:makedirs)
    ::File.makedirs settings[:location]
  else
    ::FileUtils.mkdir_p settings[:location]
  end
  envelope.to.uniq.each do |to|
    path = ::File.join(settings[:location], File.basename(to.to_s+settings[:extension]))
    ::File.open(path, 'a') do |f|
      f.write envelope.message
      f.write "\r\n\r\n"
    end
  end
end