lib/openwfe/participants/enoparticipant.rb in openwferu-0.9.2 vs lib/openwfe/participants/enoparticipant.rb in openwferu-0.9.3

- old
+ new

@@ -1,8 +1,8 @@ # #-- -# Copyright (c) 2007, Alain Hoang, OpenWFE.org +# Copyright (c) 2007, Alain Hoang and John Mettraux, OpenWFE.org # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # @@ -34,22 +34,62 @@ # # "made in Japan" # # Alain Hoang at openwfe.org +# John Mettraux at openwfe.org # require 'net/smtp' -module OpenWFE +require 'openwfe/participants/participant' +module OpenWFE + # # This participant is used to send an email notification - class EmailNotificationParticipant < LocalParticipant + # + # @engine.register_participant( + # 'eno', + # EmailNotificationParticipant.new( + # "googlemail.l.google.com", + # 25, + # "eno@outoftheblue.co.jp", + # """Subject: test 0 + # + # 0 : ${r:Time.new} + # 1 : ${f:customer_name} + # """)) + # + # And then, from the process definition : + # + # class TestDefinition0 < OpenWFE::ProcessDefinition + # def make + # process_definition :name => "test0", :revision => "0" do + # sequence do + # set :field => 'email_target' do + # "whatever56x56@gmail.com" + # end + # set :field => 'customer_name' do + # "Monsieur Toto" + # end + # participant :ref => 'eno' + # print "ok" + # end + # end + # end + # end + # + # TODO #8426 : use a block to define template + # + class EmailNotificationParticipant + include LocalParticipant + # # Create a new email notification participant. Requires # a mail server, port, a from address, and a mail message template + # def initialize (smtp_server, smtp_port, from_address, template) @smtp_server = smtp_server @smtp_port = smtp_port @from_address = from_address @template = template