From 67381c07bd8f5e5e91bf96bbd5537a2d44b314be Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 11 Nov 2016 00:04:10 +0100 Subject: [PATCH] Added port attribute for imap/pop3 and smtp. See also issue#240. --- app/assets/javascripts/app/controllers/_channel/email.coffee | 2 ++ app/models/channel/driver/imap.rb | 3 +++ app/models/channel/driver/pop3.rb | 3 +++ app/models/channel/driver/smtp.rb | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/_channel/email.coffee b/app/assets/javascripts/app/controllers/_channel/email.coffee index 01b475d75..ccb9d9e55 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.coffee @@ -528,6 +528,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false }, { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'off', }, { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true }, + { name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false }, { name: 'options::folder', display: 'Folder', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false }, ] @@ -566,6 +567,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autofocus: true }, { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, autocomplete: 'off', }, { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password', single: true }, + { name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false }, ] @form = new App.ControllerForm( el: @$('.base-outbound-settings') diff --git a/app/models/channel/driver/imap.rb b/app/models/channel/driver/imap.rb index b654ad311..ee0efbb87 100644 --- a/app/models/channel/driver/imap.rb +++ b/app/models/channel/driver/imap.rb @@ -66,6 +66,9 @@ example ssl = false port = 143 end + if options.key?(:port) && !options[:port].empty? + port = options[:port] + end Rails.logger.info "fetching imap (#{options[:host]}/#{options[:user]} port=#{port},ssl=#{ssl})" diff --git a/app/models/channel/driver/pop3.rb b/app/models/channel/driver/pop3.rb index 5eb9f58b3..cd45ab61e 100644 --- a/app/models/channel/driver/pop3.rb +++ b/app/models/channel/driver/pop3.rb @@ -51,6 +51,9 @@ returns ssl = false port = 110 end + if options.key?(:port) && !options[:port].empty? + port = options[:port] + end Rails.logger.info "fetching pop3 (#{options[:host]}/#{options[:user]} port=#{port},ssl=#{ssl})" diff --git a/app/models/channel/driver/smtp.rb b/app/models/channel/driver/smtp.rb index fb32537f5..8a05decc5 100644 --- a/app/models/channel/driver/smtp.rb +++ b/app/models/channel/driver/smtp.rb @@ -27,7 +27,7 @@ class Channel::Driver::Smtp return if Setting.get('import_mode') # set smtp defaults - if !options.key?(:port) + if !options.key?(:port) || options[:port].empty? options[:port] = 25 end if !options.key?(:domain)