Improved Hotmail/Outlook email support (#638)

This commit is contained in:
Chris Caron 2022-08-06 12:56:19 -04:00 committed by GitHub
parent d88bc9e287
commit 7f7f6863c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 3 deletions

View File

@ -111,7 +111,7 @@ EMAIL_TEMPLATES = (
'Microsoft Hotmail',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(hotmail|live)\.com)$', re.I),
r'(?P<domain>(outlook|hotmail|live)\.com(\.au)?)$', re.I),
{
'port': 587,
'smtp_host': 'smtp-mail.outlook.com',

View File

@ -382,7 +382,7 @@ def test_plugin_email(mock_smtp, mock_smtpssl):
except Exception as e:
# Handle our exception
if(instance is None):
if instance is None:
raise
if not isinstance(e, instance):
@ -835,3 +835,31 @@ def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl):
# Test that our template over-ride worked
assert 'mode=ssl' in obj.url()
assert 'smtp=override.com' in obj.url()
mock_smtp.reset_mock()
response.reset_mock()
#
# Test outlook/hotmail lookups
#
results = plugins.NotifyEmail.parse_url(
'mailtos://user:pass123@outlook.com')
obj = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj, plugins.NotifyEmail) is True
assert obj.smtp_host == 'smtp-mail.outlook.com'
results = plugins.NotifyEmail.parse_url(
'mailtos://user:pass123@outlook.com.au')
obj = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj, plugins.NotifyEmail) is True
assert obj.smtp_host == 'smtp-mail.outlook.com'
results = plugins.NotifyEmail.parse_url(
'mailtos://user:pass123@live.com')
obj = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj, plugins.NotifyEmail) is True
results = plugins.NotifyEmail.parse_url(
'mailtos://user:pass123@hotmail.com')
obj = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj, plugins.NotifyEmail) is True

View File

@ -109,7 +109,7 @@ def test_plugin_windows_mocked():
#
for mod in list(sys.modules.keys()):
if mod.startswith('apprise.'):
del(sys.modules[mod])
del sys.modules[mod]
reload(apprise)
# Create our instance