Class: Sendmail
- Inherits:
-
Object
- Object
- Sendmail
- Defined in:
- lib/sendmail.rb
Overview
Provides sendmail functionality for the reckoner script.
Instance Method Summary collapse
-
#initialize(path, options) ⇒ Sendmail
constructor
Creates the class with a path to the binary (if any is given) and options.
-
#send(to, from, subject, message) ⇒ Object
Sends the email.
Constructor Details
#initialize(path, options) ⇒ Sendmail
Creates the class with a path to the binary (if any is given) and options.
7 8 9 10 |
# File 'lib/sendmail.rb', line 7 def initialize(path,) @path = path @options = end |
Instance Method Details
#send(to, from, subject, message) ⇒ Object
Sends the email.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sendmail.rb', line 13 def send(to,from,subject,) path = @path || 'sendmail' = @options || '-i -t' cmd = %|#{path} #{}| body = "To: #{to}\n" body << "From: #{from}\n" body << "Subject: #{subject}\n" body << "\n#{}" io = IO.popen(cmd,'w') io.puts body io.close end |