Fixes #1471 - Adjust emailtrytest to zammad services.
(cherry picked from commit 3ec848a067218aa83f40d71e46c60234b3e5611b)
This commit is contained in:
parent
13e3887dd8
commit
e552795183
4 changed files with 131 additions and 54 deletions
|
@ -8,7 +8,7 @@ class Channel::Driver::Imap < Channel::EmailParser
|
|||
FETCH_MSG_TIMEOUT = 4.minutes
|
||||
EXPUNGE_TIMEOUT = 16.minutes
|
||||
DEFAULT_TIMEOUT = 45.seconds
|
||||
CHECK_ONLY_TIMEOUT = 6.seconds
|
||||
CHECK_ONLY_TIMEOUT = 8.seconds
|
||||
|
||||
def fetchable?(_channel)
|
||||
true
|
||||
|
|
|
@ -125,7 +125,7 @@ returns
|
|||
adapter: 'smtp',
|
||||
options: {
|
||||
host: 'smtp.gmail.com',
|
||||
port: 25,
|
||||
port: 587,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
|
@ -148,7 +148,7 @@ returns
|
|||
adapter: 'smtp',
|
||||
options: {
|
||||
host: 'smtp-mail.outlook.com',
|
||||
port: 25,
|
||||
port: 587,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
|
@ -171,7 +171,7 @@ returns
|
|||
adapter: 'smtp',
|
||||
options: {
|
||||
host: 'smtp.gmail.com',
|
||||
port: 25,
|
||||
port: 587,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
|
@ -416,26 +416,6 @@ returns
|
|||
outbounds = []
|
||||
mx_domains.each do |domain|
|
||||
outbound = [
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: domain,
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: user,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: domain,
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
|
@ -474,6 +454,26 @@ returns
|
|||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: domain,
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: user,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: domain,
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
]
|
||||
outbounds.concat(outbound)
|
||||
end
|
||||
|
@ -514,26 +514,6 @@ returns
|
|||
|
||||
def self.provider_outbound_guess(user, email, password, domain)
|
||||
[
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "mail.#{domain}",
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: user,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "mail.#{domain}",
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
|
@ -558,7 +538,7 @@ returns
|
|||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "smtp.#{domain}",
|
||||
port: 25,
|
||||
port: 465,
|
||||
start_tls: true,
|
||||
user: user,
|
||||
password: password,
|
||||
|
@ -568,6 +548,66 @@ returns
|
|||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "smtp.#{domain}",
|
||||
port: 465,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "mail.#{domain}",
|
||||
port: 587,
|
||||
start_tls: true,
|
||||
user: user,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "mail.#{domain}",
|
||||
port: 587,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "smtp.#{domain}",
|
||||
port: 587,
|
||||
start_tls: true,
|
||||
user: user,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "smtp.#{domain}",
|
||||
port: 587,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "mail.#{domain}",
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: user,
|
||||
password: password,
|
||||
},
|
||||
},
|
||||
{
|
||||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "mail.#{domain}",
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
|
@ -578,7 +618,7 @@ returns
|
|||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "smtp.#{domain}",
|
||||
port: 465,
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: user,
|
||||
password: password,
|
||||
|
@ -588,7 +628,7 @@ returns
|
|||
adapter: 'smtp',
|
||||
options: {
|
||||
host: "smtp.#{domain}",
|
||||
port: 465,
|
||||
port: 25,
|
||||
start_tls: true,
|
||||
user: email,
|
||||
password: password,
|
||||
|
|
|
@ -310,7 +310,7 @@ returns on fail
|
|||
else
|
||||
{
|
||||
from: email,
|
||||
to: 'emailtrytest@znuny.com',
|
||||
to: 'verify-external-smtp-sending@discard.zammad.org',
|
||||
subject: 'This is a Test Email',
|
||||
body: "This is a test email from Zammad to verify if Zammad can send emails to an external address.\n\nIf you see this email, you can ignore or delete it.",
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class EmailHelperTest < ActiveSupport::TestCase
|
|||
|
||||
assert_equal('smtp', map[:google_imap][:outbound][:adapter])
|
||||
assert_equal('smtp.gmail.com', map[:google_imap][:outbound][:options][:host])
|
||||
assert_equal(25, map[:google_imap][:outbound][:options][:port])
|
||||
assert_equal(587, map[:google_imap][:outbound][:options][:port])
|
||||
assert_equal(true, map[:google_imap][:outbound][:options][:start_tls])
|
||||
assert_equal(email, map[:google_imap][:outbound][:options][:user])
|
||||
assert_equal(password, map[:google_imap][:outbound][:options][:password])
|
||||
|
@ -89,6 +89,17 @@ class EmailHelperTest < ActiveSupport::TestCase
|
|||
assert_equal(email, map[1][:options][:user])
|
||||
assert_equal(password, map[1][:options][:password])
|
||||
|
||||
assert_equal('imap', map[2][:adapter])
|
||||
assert_equal('imap.zammad.com', map[2][:options][:host])
|
||||
assert_equal(993, map[2][:options][:port])
|
||||
assert_equal(user, map[2][:options][:user])
|
||||
assert_equal(password, map[2][:options][:password])
|
||||
|
||||
assert_equal('imap', map[3][:adapter])
|
||||
assert_equal('imap.zammad.com', map[3][:options][:host])
|
||||
assert_equal(993, map[3][:options][:port])
|
||||
assert_equal(email, map[3][:options][:user])
|
||||
assert_equal(password, map[3][:options][:password])
|
||||
end
|
||||
|
||||
test 'provider_outbound_mx' do
|
||||
|
@ -101,18 +112,31 @@ class EmailHelperTest < ActiveSupport::TestCase
|
|||
|
||||
assert_equal('smtp', map[0][:adapter])
|
||||
assert_equal('mx2.zammad.com', map[0][:options][:host])
|
||||
assert_equal(25, map[0][:options][:port])
|
||||
assert_equal(465, map[0][:options][:port])
|
||||
assert_equal(true, map[0][:options][:start_tls])
|
||||
assert_equal(user, map[0][:options][:user])
|
||||
assert_equal(password, map[0][:options][:password])
|
||||
|
||||
assert_equal('smtp', map[1][:adapter])
|
||||
assert_equal('mx2.zammad.com', map[1][:options][:host])
|
||||
assert_equal(25, map[1][:options][:port])
|
||||
assert_equal(465, map[1][:options][:port])
|
||||
assert_equal(true, map[1][:options][:start_tls])
|
||||
assert_equal(email, map[1][:options][:user])
|
||||
assert_equal(password, map[1][:options][:password])
|
||||
|
||||
assert_equal('smtp', map[2][:adapter])
|
||||
assert_equal('mx2.zammad.com', map[2][:options][:host])
|
||||
assert_equal(587, map[2][:options][:port])
|
||||
assert_nil(map[2][:options][:start_tls])
|
||||
assert_equal(user, map[2][:options][:user])
|
||||
assert_equal(password, map[2][:options][:password])
|
||||
|
||||
assert_equal('smtp', map[3][:adapter])
|
||||
assert_equal('mx2.zammad.com', map[3][:options][:host])
|
||||
assert_equal(587, map[3][:options][:port])
|
||||
assert_nil(map[3][:options][:start_tls])
|
||||
assert_equal(email, map[3][:options][:user])
|
||||
assert_equal(password, map[3][:options][:password])
|
||||
end
|
||||
|
||||
test 'provider_outbound_guess' do
|
||||
|
@ -124,18 +148,31 @@ class EmailHelperTest < ActiveSupport::TestCase
|
|||
|
||||
assert_equal('smtp', map[0][:adapter])
|
||||
assert_equal('mail.zammad.com', map[0][:options][:host])
|
||||
assert_equal(25, map[0][:options][:port])
|
||||
assert_equal(465, map[0][:options][:port])
|
||||
assert_equal(true, map[0][:options][:start_tls])
|
||||
assert_equal(user, map[0][:options][:user])
|
||||
assert_equal(password, map[0][:options][:password])
|
||||
|
||||
assert_equal('smtp', map[1][:adapter])
|
||||
assert_equal('mail.zammad.com', map[1][:options][:host])
|
||||
assert_equal(25, map[1][:options][:port])
|
||||
assert_equal(465, map[1][:options][:port])
|
||||
assert_equal(true, map[1][:options][:start_tls])
|
||||
assert_equal(email, map[1][:options][:user])
|
||||
assert_equal(password, map[1][:options][:password])
|
||||
|
||||
assert_equal('smtp', map[2][:adapter])
|
||||
assert_equal('smtp.zammad.com', map[2][:options][:host])
|
||||
assert_equal(465, map[2][:options][:port])
|
||||
assert_equal(true, map[2][:options][:start_tls])
|
||||
assert_equal(user, map[2][:options][:user])
|
||||
assert_equal(password, map[2][:options][:password])
|
||||
|
||||
assert_equal('smtp', map[3][:adapter])
|
||||
assert_equal('smtp.zammad.com', map[3][:options][:host])
|
||||
assert_equal(465, map[3][:options][:port])
|
||||
assert_equal(true, map[3][:options][:start_tls])
|
||||
assert_equal(email, map[3][:options][:user])
|
||||
assert_equal(password, map[3][:options][:password])
|
||||
end
|
||||
|
||||
test 'z probe_inbound' do
|
||||
|
@ -525,7 +562,7 @@ class EmailHelperTest < ActiveSupport::TestCase
|
|||
adapter: 'smtp',
|
||||
options: {
|
||||
host: 'smtp.gmail.com',
|
||||
port: 25,
|
||||
port: 587,
|
||||
start_tls: true,
|
||||
user: mailbox_user,
|
||||
password: mailbox_password,
|
||||
|
|
Loading…
Reference in a new issue