lib/subtrigger/email.rb in subtrigger-0.2.5 vs lib/subtrigger/email.rb in subtrigger-0.2.6
- old
+ new
@@ -11,12 +11,10 @@
# :from => 'eric@idle.com',
# :subject => 'Fired',
# :body => 'Your post-commit hook has just fired').send
#
# If +sendmail+ can not be found on your system an exception will be raised.
- #--
- # TODO: Use a hash of options rather than plain arguments.
class Email
attr_accessor :from, :to, :subject, :body, :development
attr_reader :sendmail
# Sets up a new message and tries to find +sendmail+ on your system.
@@ -29,9 +27,10 @@
@sendmail = Subtrigger.sendmail || `which sendmail`.strip
raise 'Could not find sendmail; aborting.' if @sendmail.nil?
end
# Tries to use +sendmail+ to send the message.
+ # The message sent is returned for inspecting purposes.
def send
message = header + "\n" + body
unless development
fd = open("|#{sendmail} #{to}", "w")
fd.print(message)
\ No newline at end of file