Class: Tzispa::Utils::Mail
- Inherits:
-
Object
- Object
- Tzispa::Utils::Mail
- Defined in:
- lib/tzispa/utils/mail.rb
Constant Summary collapse
- DEFAULT_CHARSET =
'UTF-8'
Instance Attribute Summary collapse
-
#cc ⇒ Object
Returns the value of attribute cc.
-
#charset ⇒ Object
Returns the value of attribute charset.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#content ⇒ Object
Returns the value of attribute content.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#from ⇒ Object
Returns the value of attribute from.
-
#html ⇒ Object
Returns the value of attribute html.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#mail ⇒ Object
readonly
Returns the value of attribute mail.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #add_file(path, attach_name) ⇒ Object
-
#initialize(config, logger = nil) ⇒ Mail
constructor
A new instance of Mail.
- #send_mail ⇒ Object
Constructor Details
#initialize(config, logger = nil) ⇒ Mail
Returns a new instance of Mail.
16 17 18 19 20 21 22 23 24 |
# File 'lib/tzispa/utils/mail.rb', line 16 def initialize(config, logger = nil) @hmtl = false @debug = false @charset = DEFAULT_CHARSET @logger = logger @config = config smtp_configuration(config) @mail = ::Mail.new end |
Instance Attribute Details
#cc ⇒ Object
Returns the value of attribute cc.
9 10 11 |
# File 'lib/tzispa/utils/mail.rb', line 9 def cc @cc end |
#charset ⇒ Object
Returns the value of attribute charset.
9 10 11 |
# File 'lib/tzispa/utils/mail.rb', line 9 def charset @charset end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/tzispa/utils/mail.rb', line 12 def config @config end |
#content ⇒ Object
Returns the value of attribute content.
9 10 11 |
# File 'lib/tzispa/utils/mail.rb', line 9 def content @content end |
#debug ⇒ Object
Returns the value of attribute debug.
9 10 11 |
# File 'lib/tzispa/utils/mail.rb', line 9 def debug @debug end |
#from ⇒ Object
Returns the value of attribute from.
9 10 11 |
# File 'lib/tzispa/utils/mail.rb', line 9 def from @from end |
#html ⇒ Object
Returns the value of attribute html.
9 10 11 |
# File 'lib/tzispa/utils/mail.rb', line 9 def html @html end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'lib/tzispa/utils/mail.rb', line 12 def logger @logger end |
#mail ⇒ Object (readonly)
Returns the value of attribute mail.
12 13 14 |
# File 'lib/tzispa/utils/mail.rb', line 12 def mail @mail end |
#subject ⇒ Object
Returns the value of attribute subject.
9 10 11 |
# File 'lib/tzispa/utils/mail.rb', line 9 def subject @subject end |
#to ⇒ Object
Returns the value of attribute to.
9 10 11 |
# File 'lib/tzispa/utils/mail.rb', line 9 def to @to end |
Instance Method Details
#add_file(path, attach_name) ⇒ Object
36 37 38 |
# File 'lib/tzispa/utils/mail.rb', line 36 def add_file(path, attach_name) mail.[attach_name] = File.read(path) end |
#send_mail ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/tzispa/utils/mail.rb', line 26 def send_mail recipients body mail.subject = subject mail.charset = charset mail.deliver rescue raise if debug end |