Sha256: d8d5eb6bd0f6225eb3d021ca505532fe2276c1743d028c139ec400a71c9a602a
Contents?: true
Size: 895 Bytes
Versions: 6
Compression:
Stored size: 895 Bytes
Contents
require 'mail' module InboxSync; end module InboxSync::Notice class Base attr_reader :mail def initialize(smtp, config) @smtp = smtp @config = config @mail = ::Mail.new @mail.from = self.from @mail.to = self.to @mail.subject = self.subject @mail.body = self.body end def from; @config.from_addr; end def to; @config.to_addr; end def subject(msg="notice") "[inbox-sync] #{msg}" end def body raise RuntimeError, "subclass `Notice::Base` and define your body" end def send @smtp.start(helo, user, pw, authtype) do |smtp| smtp.send_message(@mail.to_s, from, to) end end protected def helo; @config.helo; end def user; @config.login.user; end def pw; @config.login.pw; end def authtype; @config.authtype; end end end
Version data entries
6 entries across 6 versions & 1 rubygems