class Mail::Sendmail
def popen(command, &block)
def popen(command, &block) IO.popen(command, 'w+', :err => :out, &block).tap do if $?.exitstatus != 0 raise DeliveryError, "Delivery failed with exitstatus #{$?.exitstatus}: #{command.inspect}" end end end