mirror of
https://github.com/Mailu/Mailu.git
synced 2025-01-18 03:21:36 +02:00
Fix it
This commit is contained in:
parent
7b46c7bcb6
commit
a09c23d8de
@ -122,6 +122,13 @@ service imap-login {
|
||||
}
|
||||
}
|
||||
|
||||
service pop3-login {
|
||||
inet_listener pop3 {
|
||||
port = 110
|
||||
haproxy = yes
|
||||
}
|
||||
}
|
||||
|
||||
###############
|
||||
# Delivery
|
||||
###############
|
||||
|
@ -6,28 +6,29 @@ import smtplib
|
||||
import os
|
||||
|
||||
SERVER='localhost'
|
||||
USERNAME='test@mailu.io'
|
||||
USERNAME='user@mailu.io'
|
||||
PASSWORD='password'
|
||||
|
||||
def test_imap(server, username, password):
|
||||
print(f'Authenticating to imaps://{username}:{password}@{server}:993/')
|
||||
with imaplib.IMAP4_SSL(server) as conn:
|
||||
conn.login(username, password)
|
||||
if conn.status('inbox')[0] != 'OK':
|
||||
print(f'Authenticating to imaps://{username}:{password}@{server}:993/ failed!')
|
||||
os.exit(101)
|
||||
conn.noop()
|
||||
print('OK')
|
||||
print(f'Authenticating to imaps://{username}:{password}@{server}:143/')
|
||||
with imaplib.IMAP4(server) as conn:
|
||||
conn.starttls()
|
||||
conn.login(username, password)
|
||||
if conn.status('inbox')[0] != 'OK':
|
||||
print(f'Authenticating to imap://{username}:{password}@{server}:143/ failed!')
|
||||
os.exit(101)
|
||||
conn.noop()
|
||||
print('OK')
|
||||
print(f'Authenticating to imap://{username}:{password}@{server}:143/')
|
||||
try:
|
||||
with imaplib.IMAP4(server) as conn:
|
||||
conn.login(username, password)
|
||||
print(f'Authenticating to imap://{username}:{password}@{server}:143/ worked without STARTTLS!')
|
||||
os.exit(102)
|
||||
except imaplib.error:
|
||||
pass
|
||||
except imaplib.IMAP4.error:
|
||||
print('NOK')
|
||||
|
||||
def test_pop3(server, username, password):
|
||||
print(f'Authenticating to pop3s://{username}:{password}@{server}:995/')
|
||||
@ -36,6 +37,7 @@ def test_pop3(server, username, password):
|
||||
conn.user(username)
|
||||
conn.pass_(password)
|
||||
conn.close()
|
||||
print('OK')
|
||||
print(f'Authenticating to pop3s://{username}:{password}@{server}:110/')
|
||||
conn = poplib.POP3(server)
|
||||
conn.stls()
|
||||
@ -43,6 +45,7 @@ def test_pop3(server, username, password):
|
||||
conn.user(username)
|
||||
conn.pass_(password)
|
||||
conn.close()
|
||||
print('OK')
|
||||
print(f'Authenticating to pop3://{username}:{password}@{server}:110/')
|
||||
try:
|
||||
conn = poplib.POP3(server)
|
||||
@ -53,25 +56,47 @@ def test_pop3(server, username, password):
|
||||
print(f'Authenticating to pop3://{username}:{password}@{server}:110/ worked without STARTTLS!')
|
||||
os.exit(103)
|
||||
except poplib.error_proto:
|
||||
pass
|
||||
print('NOK')
|
||||
|
||||
def test_SMTP(server, username, password):
|
||||
print(f'Authenticating to smtps://{username}:{password}@{server}:465/')
|
||||
with smtplib.SMTP_SSL(server) as conn:
|
||||
conn.ehlo()
|
||||
conn.login(username, password)
|
||||
with smtplib.SMTP(server) as conn:
|
||||
print('OK')
|
||||
print(f'Authenticating to smtps://{username}:{password}@{server}:587/')
|
||||
with smtplib.SMTP(server, 587) as conn:
|
||||
conn.ehlo()
|
||||
conn.starttls()
|
||||
conn.ehlo()
|
||||
conn.login(username, password)
|
||||
print('OK')
|
||||
try:
|
||||
print(f'Authenticating to smtp://{username}:{password}@{server}:587/')
|
||||
with smtplib.SMTP(server, 587) as conn:
|
||||
conn.ehlo()
|
||||
conn.login(username, password)
|
||||
except smtplib.SMTPNotSupportedError:
|
||||
print('NOK')
|
||||
#port 25 should fail
|
||||
try:
|
||||
print(f'Authenticating to smtps://{username}:{password}@{server}:25/')
|
||||
with smtplib.SMTP(server) as conn:
|
||||
conn.ehlo()
|
||||
conn.starttls()
|
||||
conn.ehlo()
|
||||
conn.login(username, password)
|
||||
except smtplib.SMTPNotSupportedError:
|
||||
print('NOK')
|
||||
try:
|
||||
print(f'Authenticating to smtp://{username}:{password}@{server}:25/')
|
||||
with smtplib.SMTP(server) as conn:
|
||||
conn.ehlo()
|
||||
conn.login(username, password)
|
||||
print(f'Authenticating to smtp://{username}:{password}@{server}:25/ worked without STARTTLS!')
|
||||
print(f'Authenticating to smtp://{username}:{password}@{server}:587/ worked without STARTTLS!')
|
||||
os.exit(104)
|
||||
except smtplib.SMTPNotSupportedError:
|
||||
pass
|
||||
print('NOK')
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_imap(SERVER, USERNAME, PASSWORD)
|
||||
|
1
towncrier/newsfragments/2756.bugfix
Normal file
1
towncrier/newsfragments/2756.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix a bug preventing POP3 from being usable
|
Loading…
x
Reference in New Issue
Block a user