lib/openwfe/participants/enoparticipants.rb in openwferu-0.9.15 vs lib/openwfe/participants/enoparticipants.rb in openwferu-0.9.16
- old
+ new
@@ -39,10 +39,11 @@
#
require 'net/smtp'
require 'openwfe/participants/participant'
+require 'openwfe/participants/participants'
module OpenWFE
#
@@ -87,10 +88,11 @@
#
# The smtp server and host default to "127.0.0.1" / 25.
#
class MailParticipant
include LocalParticipant
+ include TemplateMixin
def initialize (params, &block)
@smtp_server = params[:smtp_server]
@smtp_port = params[:smtp_port]
@@ -114,26 +116,14 @@
to_address = workitem.email_target
#
# 1. Expand variables
- msg = if @block_template
- #@block_template.call(fe, self, workitem)
- call_block @block_template, workitem
- elsif @template
- template = if @template.kind_of? File
- @template.readlines
- else
- @template.to_s
- end
- OpenWFE::dosub(template, fe, workitem)
- else
- "(no template given)"
- end
+ msg = eval_template workitem
from_address = workitem.email_from rescue @from_address
- puts "msg >>>\n#{msg}<<<"
+ #puts "msg >>>\n#{msg}<<<"
#
# 2. Send message
Net::SMTP.start(@smtp_server, @smtp_port) do |smtp|