Methods

Logging::Appenders::Email

Attributes

acct[R]
authtype[R]
domain[R]
port[R]
server[R]
subject[R]

Public Class Methods

new( name, opts = {} ) click to toggle source

TODO: make the from/to fields modifiable

possibly the subject, too
# File lib/logging/appenders/email.rb, line 20
def initialize( name, opts = {} )
  super(name, opts)

  af = opts.getopt(:buffsize) ||
       opts.getopt(:buffer_size) ||
       100
  configure_buffering({:auto_flushing => af}.merge(opts))

  # get the SMTP parameters
  @from = opts.getopt(:from)
  raise ArgumentError, 'Must specify from address' if @from.nil?

  @to = opts.getopt(:to, '').split(',')
  raise ArgumentError, 'Must specify recipients' if @to.empty?

  @server   = opts.getopt :server, 'localhost'
  @port     = opts.getopt :port, 25, :as => Integer
  @domain   = opts.getopt(:domain, ENV['HOSTNAME']) || 'localhost.localdomain'
  @acct     = opts.getopt :acct
  @passwd   = opts.getopt :passwd
  @authtype = opts.getopt :authtype, :cram_md5, :as => Symbol
  @subject  = opts.getopt :subject, "Message of #{$0}"
  @params   = [@server, @port, @domain, @acct, @passwd, @authtype]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.