Class: RbEAI::PutEmailLogic
- Inherits:
-
Object
- Object
- RbEAI::PutEmailLogic
- Defined in:
- lib/rbeai/PutLogic.rb
Overview
Instance Method Summary collapse
-
#initialize(protNode, task) ⇒ PutEmailLogic
constructor
A new instance of PutEmailLogic.
- #putFile(obj) ⇒ Object
Constructor Details
#initialize(protNode, task) ⇒ PutEmailLogic
Returns a new instance of PutEmailLogic.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/rbeai/PutLogic.rb', line 60 def initialize(protNode, task) @task = task location = XPath.first(protNode, "./location") account = XPath.first(protNode, "./account") @address = location.attributes["address"] @domain = location.attributes["domain"] @port = location.attributes["port"] @name = account.attributes["name"] @pwd = account.attributes["pwd"] @from = XPath.first(protNode, "./from/text()") @to = XPath.first(protNode, "./to/text()") @subject = XPath.first(protNode, "./subject/text()") @bodymsg = XPath.first(protNode, "./body/text()") @attachment = XPath.first(protNode, "./attachment/text()") end |
Instance Method Details
#putFile(obj) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/rbeai/PutLogic.rb', line 76 def putFile(obj) begin smtp = if @name != nil Net::SMTP.start(@address, @port, @domain, @name, @pwd, :login) elsif @domain != nil Net::SMTP.start(@address, @port, @domain) else Net::SMTP.start(@address, @port) end = _buildMessage(obj) smtp. , "#{@from}", "#{@to}".split(",").each { |to| to.strip! } smtp.finish rescue Exception puts $! end end |