Class: MailHandler::Sending::SMTPSender

Inherits:
Sender
  • Object
show all
Defined in:
lib/mailhandler/sending/smtp.rb

Overview

class which describes methods to send and receive emails

Instance Attribute Summary collapse

Attributes inherited from Sender

#type

Instance Method Summary collapse

Constructor Details

#initializeSMTPSender

Returns a new instance of SMTPSender.



20
21
22
23
24
25
26
27
28
# File 'lib/mailhandler/sending/smtp.rb', line 20

def initialize
  @type = :smtp
  @authentication = 'plain'
  @use_ssl = false
  @save_response = false

  @open_timeout = 60
  @read_timeout = 60
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



8
9
10
# File 'lib/mailhandler/sending/smtp.rb', line 8

def address
  @address
end

#authenticationObject

Returns the value of attribute authentication.



8
9
10
# File 'lib/mailhandler/sending/smtp.rb', line 8

def authentication
  @authentication
end

#domainObject

Returns the value of attribute domain.



8
9
10
# File 'lib/mailhandler/sending/smtp.rb', line 8

def domain
  @domain
end

#open_timeoutObject

Returns the value of attribute open_timeout.



16
17
18
# File 'lib/mailhandler/sending/smtp.rb', line 16

def open_timeout
  @open_timeout
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/mailhandler/sending/smtp.rb', line 8

def password
  @password
end

#portObject

Returns the value of attribute port.



8
9
10
# File 'lib/mailhandler/sending/smtp.rb', line 8

def port
  @port
end

#read_timeoutObject

Returns the value of attribute read_timeout.



16
17
18
# File 'lib/mailhandler/sending/smtp.rb', line 16

def read_timeout
  @read_timeout
end

#save_responseObject

Returns the value of attribute save_response.



16
17
18
# File 'lib/mailhandler/sending/smtp.rb', line 16

def save_response
  @save_response
end

#use_sslObject

Returns the value of attribute use_ssl.



8
9
10
# File 'lib/mailhandler/sending/smtp.rb', line 8

def use_ssl
  @use_ssl
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/mailhandler/sending/smtp.rb', line 8

def username
  @username
end

Instance Method Details

#send(email) ⇒ Object



30
31
32
33
34
# File 'lib/mailhandler/sending/smtp.rb', line 30

def send(email)
  verify_email(email)
  email = configure_sending(email)
  save_response ? email.deliver! : email.deliver
end