Class: Mail::SMTP

Inherits:
Object
  • Object
show all
Defined in:
lib/mailhandler/extensions/mail/smtp.rb

Overview

wrapper methods to support sending raw email, where recipient and sender can be custom

Instance Method Summary collapse

Instance Method Details

#deliver_raw!(raw_source_email, smtp_from, smtp_to) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/mailhandler/extensions/mail/smtp.rb', line 6

def deliver_raw!(raw_source_email, smtp_from, smtp_to)
  response = start_smtp_session do |smtp|
    Mail::SMTPConnection.new(connection: smtp, return_response: true)
                        .deliver_raw!(raw_source_email, smtp_from, smtp_to)
  end

  settings[:return_response] ? response : self
end