tags:

views:

306

answers:

1

Hey folks,

Im using Pony to send email withing my sinatra applications. But the problem - i cant figure out how to debug or test it. Lest say, in php you can configure sendmail fake app (in php.ini) that will store all outgoing email as plain textfiles with all data in it.

How about ruby apps? Is it possible?

+1  A: 

You surely found the solution already yourself

In the pony.rb file there is this code part which sends the mail:

def self.transport(tmail)
 .. 
end

You can simply add a method to return the env:

def debug?
 true #false
end

and do something special if debug mode is on

def self.transport(tmail)
 puts "Debug message" if debug?
 if File.executable? sendmail_binary
  transport_via_sendmail(tmail)
 else
  transport_via_smtp(tmail)
 end
end
Beffa