Fixed Outlook.com email template (#755)

This commit is contained in:
Chris Caron 2022-11-12 14:44:59 -05:00 committed by GitHub
parent 29e4c5ebd8
commit 2912dfd1e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 3 deletions

View File

@ -112,7 +112,7 @@ EMAIL_TEMPLATES = (
'Microsoft Hotmail',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(outlook|hotmail|live)\.com(\.au)?)$', re.I),
r'(?P<domain>(hotmail|live)\.com(\.au)?)$', re.I),
{
'port': 587,
'smtp_host': 'smtp-mail.outlook.com',
@ -122,6 +122,21 @@ EMAIL_TEMPLATES = (
},
),
# Microsoft Outlook
(
'Microsoft Outlook',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(smtp\.)?outlook\.com(\.au)?)$', re.I),
{
'port': 587,
'smtp_host': 'smtp.outlook.com',
'secure': True,
'secure_mode': SecureMailMode.STARTTLS,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Microsoft Office 365 (Email Server)
# You must specify an authenticated sender address in the from= settings
# and a valid email in the to= to deliver your emails to

View File

@ -971,7 +971,7 @@ def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl):
'mailtos://user:pass123@outlook.com')
obj = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj, NotifyEmail) is True
assert obj.smtp_host == 'smtp-mail.outlook.com'
assert obj.smtp_host == 'smtp.outlook.com'
# No entries in the reply_to
assert not obj.reply_to
@ -979,10 +979,32 @@ def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl):
'mailtos://user:pass123@outlook.com.au')
obj = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj, NotifyEmail) is True
assert obj.smtp_host == 'smtp-mail.outlook.com'
assert obj.smtp_host == 'smtp.outlook.com'
# No entries in the reply_to
assert not obj.reply_to
# Consisitency Checks
results = NotifyEmail.parse_url(
'mailtos://outlook.com?smtp=smtp.outlook.com'
'&user=user@outlook.com&pass=app.pw')
obj1 = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj1, NotifyEmail) is True
assert obj1.smtp_host == 'smtp.outlook.com'
assert obj1.user == 'user@outlook.com'
assert obj1.password == 'app.pw'
assert obj1.secure_mode == 'starttls'
assert obj1.port == 587
results = NotifyEmail.parse_url(
'mailtos://user:app.pw@outlook.com')
obj2 = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj2, NotifyEmail) is True
assert obj2.smtp_host == obj1.smtp_host
assert obj2.user == obj1.user
assert obj2.password == obj1.password
assert obj2.secure_mode == obj1.secure_mode
assert obj2.port == obj1.port
results = NotifyEmail.parse_url(
'mailtos://user:pass123@live.com')
obj = Apprise.instantiate(results, suppress_exceptions=False)