class SimpleMailer require 'base64' require 'net/smtp' require 'shared-mime-info' MARKER="THATSMAMARKER" def initialize(host="",port=25) @host=host @port=port @from='' @to='' @title='' @message='' @body='' @files=Array.new end # Want an array def to(to) to.each do |ad| raise "Not a proper email address" unless ad.match(/.+@.+\..+/) end @to=to self end def from(from) raise "Not a proper email address" unless from.match(/.+@.+\..+/) @from=from self end def title(title) @title=title self end def message(message) @message=message self end # WARNING : with_files clear @files before adding new ones def attach_files(files) @files=Array.new files.each do |file| raise "File #{file} doesn't exist" unless File.exists?(file) raise "Can't read file #{file}" unless File.readable?(file) @files< e e end end end end