Class: DAF::EmailAction
- Defined in:
- lib/daf/actions/email_action.rb
Overview
An action that sends an email based on parameters
Instance Method Summary collapse
Methods inherited from Action
Methods included from Configurable
Instance Method Details
#format_email(to, from, subject, body) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/daf/actions/email_action.rb', line 24 def format_email(to, from, subject, body) <<TEXT From: #{from} To: #{to} Subject: #{subject} #{body} TEXT end |
#invoke ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/daf/actions/email_action.rb', line 14 def invoke = format_email(@to.value, @from.value, @subject.value, @body.value) port = self.port.valid? ? self.port.value : 25 Net::SMTP.start(@server.value, port) do |smtp| smtp.(, @from.value, @to.value) end true end |