# File lib/protocols/smtpclient.rb, line 78
78:                 def self.send args={}
79:                         args[:port] ||= 25
80:                         args[:body] ||= ""
81:                         begin
82:                                 EventMachine.connect( args[:host], args[:port], self) {|c|
83:                                         # According to the EM docs, we will get here AFTER post_init is called.
84:                                         c.args = args
85:                                         c.set_comm_inactivity_timeout 60
86:                                 }
87:                         rescue
88:                                 # We'll get here on a connect error. This code mimics the effect
89:                                 # of a call to invoke_internal_error. Would be great to DRY this up.
90:                                 # (Actually, it may be that we never get here, if EM#connect catches
91:                                 # its errors internally.)
92:                                 d = EM::DefaultDeferrable.new
93:                                 d.set_deferred_status(:failed, {:error=>[:connect, 500, "unable to connect to server"]})
94:                                 d
95:                         end
96:                 end