Class: Mailing::Sender

Inherits:
Object
  • Object
show all
Defined in:
lib/mailing/sender.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel, envelope_from, logger = nil, delay = DELAY) ⇒ Sender

Returns a new instance of Sender.



7
8
9
10
11
12
# File 'lib/mailing/sender.rb', line 7

def initialize(channel, envelope_from, logger=nil, delay=DELAY)
  @channel = channel
  @envelope_from = envelope_from
  @logger = logger
  @delay = delay
end

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



5
6
7
# File 'lib/mailing/sender.rb', line 5

def channel
  @channel
end

#delayObject

Returns the value of attribute delay.



5
6
7
# File 'lib/mailing/sender.rb', line 5

def delay
  @delay
end

#envelope_fromObject

Returns the value of attribute envelope_from.



5
6
7
# File 'lib/mailing/sender.rb', line 5

def envelope_from
  @envelope_from
end

#loggerObject

Returns the value of attribute logger.



5
6
7
# File 'lib/mailing/sender.rb', line 5

def logger
  @logger
end

Instance Method Details

#send(mailing) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/mailing/sender.rb', line 14

def send(mailing)
  @mailing = mailing
  @mail = @mailing.mail
  info "Start mailing: #{Time.now}"
  info @mail.encoded
  info "Recipients count: #{@mailing.recipients.size}"
  deliver
end