class FDE::Mail

Attributes

attachment[RW]
body[RW]
from[RW]
mail[RW]
subject[RW]
to[RW]

Public Class Methods

new(from, to, subject, body, attachment) click to toggle source
# File lib/fde/mail_sender/mail.rb, line 5
def initialize(from, to, subject, body, attachment)
  @from = from
  @to = to
  @subject = subject
  @body = body
  @attachment = attachment
  build
end

Public Instance Methods

build() click to toggle source
# File lib/fde/mail_sender/mail.rb, line 14
def build
  from = @from
  to = @to
  subject = @subject
  body = @body
  filename = File.basename(@attachment)
  content = File.read(@attachment)

  @mail = ::Mail.new do
    from(from)
    to(to)
    subject(subject)
    body(body)
    add_file(filename: filename, content: content)
  end
end
deliver!() click to toggle source
# File lib/fde/mail_sender/mail.rb, line 31
def deliver!
  FDE::MailSender.smtp_account.deliver!(@mail)
end