Module: KNSEmailEndpoint::ConnectionFactory
- Included in:
- Connection
- Defined in:
- lib/kns_email_endpoint/connection.rb
Instance Attribute Summary collapse
-
#appid ⇒ Object
readonly
Returns the value of attribute appid.
-
#conn_log ⇒ Object
readonly
Returns the value of attribute conn_log.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#event_args ⇒ Object
readonly
Returns the value of attribute event_args.
-
#max_retry_count ⇒ Object
readonly
Returns the value of attribute max_retry_count.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#process_mode ⇒ Object
readonly
Returns the value of attribute process_mode.
-
#retriever ⇒ Object
readonly
Returns the value of attribute retriever.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
Instance Method Summary collapse
Instance Attribute Details
#appid ⇒ Object (readonly)
Returns the value of attribute appid.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def appid @appid end |
#conn_log ⇒ Object (readonly)
Returns the value of attribute conn_log.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def conn_log @conn_log end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def environment @environment end |
#event_args ⇒ Object (readonly)
Returns the value of attribute event_args.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def event_args @event_args end |
#max_retry_count ⇒ Object (readonly)
Returns the value of attribute max_retry_count.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def max_retry_count @max_retry_count end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def name @name end |
#process_mode ⇒ Object (readonly)
Returns the value of attribute process_mode.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def process_mode @process_mode end |
#retriever ⇒ Object (readonly)
Returns the value of attribute retriever.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def retriever @retriever end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
10 11 12 |
# File 'lib/kns_email_endpoint/connection.rb', line 10 def sender @sender end |
Instance Method Details
#setup_mail_connections(name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/kns_email_endpoint/connection.rb', line 12 def setup_mail_connections(name) @config = Configuration @conn_config = @config[name] if @config.logdir.empty? log_dest = STDOUT else log_dest = "#{@config.logdir}/#{@conn_config['logfile']}" end @config.log.info "Initializing connection log to: #{log_dest}" @conn_log = Logger.new(log_dest, "daily") @conn_log.level = @config.log.level @name = @conn_config["name"] @process_mode = @conn_config["processmode"].to_sym @max_retry_count = @conn_config["max_retry_count"] || 10 @event_args = @conn_config["args"] || {} @appid = @conn_config["appid"] if @conn_config["appversion"] && (@conn_config["appversion"] == "dev" || @conn_config["appversion"] == "development") @environment = :development else @environment = :production end @in_method = @conn_config["incoming"]["method"] @out_method = @conn_config["smtp"]["method"] @retriever_settings = { :address => @conn_config["incoming"]["host"], :user_name => @conn_config["incoming"]["username"], :password => @conn_config["incoming"]["password"], :enable_ssl => @conn_config["incoming"]["ssl"], :port => @conn_config["incoming"]["port"], :authentication => @conn_config["incoming"]["authentication"] || nil } @mailbox = @conn_config["incoming"]["mailbox"] @retriever = lookup_retriever @sender_settings = { :address => @conn_config["smtp"]["host"], :user_name => @conn_config["smtp"]["username"], :password => @conn_config["smtp"]["password"], :port => @conn_config["smtp"]["port"], :domain => @conn_config["smtp"]["helo_domain"], :enable_starttls_auto => @conn_config["smtp"]["tls"] } if @conn_config["smtp"]["authentication"] @sender_settings[:authentication] = @conn_config["smtp"]["authentication"].downcase end @sender = lookup_sender end |