Sha256: 279677dcb8374e60a43df244e6e331e1e5498b55437da578b3382e7aab1e0027

Contents?: true

Size: 556 Bytes

Versions: 5

Compression:

Stored size: 556 Bytes

Contents

require 'rbbt'
require 'rbbt/util/misc'
module Sinatra
  module SinatraRbbt

    def valid_email?(email)
      !!(email =~ /\w@\w/)
    end

    def can_send_email?
      Rbbt.etc.smtp_config.exists?
    end

    def send_email(workflow, to, subject, message)
      Log.low "Sending email to: #{ to }. Subject: #{ subject }"
      raise "Cannot send emails, config is missing" if not can_send_email?
      mail_options = Rbbt.etc.smtp_config.yaml
      Misc.send_email("no-replay@#{workflow.to_s}", to, subject, message, mail_options)
    end
  end
end

 

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rbbt-views-2.0.2 lib/rbbt/workflow/rest/email.rb
rbbt-views-2.0.1 lib/rbbt/workflow/rest/email.rb
rbbt-views-2.0.0 lib/rbbt/workflow/rest/email.rb
rbbt-views-1.0.1 lib/rbbt/workflow/rest/email.rb
rbbt-views-1.0.0 lib/rbbt/workflow/rest/email.rb