Skip to content

Commit

Permalink
comcast.net email template added (#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc committed Feb 21, 2024
1 parent 30ebc30 commit 010be0b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apprise/plugins/NotifyEmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,21 @@ class SecureMailMode:
},
),

# Comcast.net
(
'Comcast.net',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(comcast)\.net)$', re.I),
{
'port': 465,
'smtp_host': 'smtp.comcast.net',
'secure': True,
'secure_mode': SecureMailMode.SSL,
'login_type': (WebBaseLogin.EMAIL, )
},
),

# Catch All
(
'Custom',
Expand Down
28 changes: 28 additions & 0 deletions test/test_plugin_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,34 @@ def test_plugin_email_url_parsing(mock_smtp, mock_smtp_ssl):
mock_smtp_ssl.reset_mock()
response.reset_mock()

results = NotifyEmail.parse_url(
'mailto://user:pass@comcast.net')
obj = Apprise.instantiate(results, suppress_exceptions=False)
assert isinstance(obj, NotifyEmail) is True
assert obj.smtp_host == 'smtp.comcast.net'
assert obj.user == 'user@comcast.net'
assert obj.password == 'pass'
assert obj.secure_mode == 'ssl'
assert obj.port == 465

assert mock_smtp.call_count == 0
assert mock_smtp_ssl.call_count == 0
assert response.starttls.call_count == 0
assert obj.notify("test") is True
assert mock_smtp.call_count == 0
assert mock_smtp_ssl.call_count == 1
assert response.starttls.call_count == 0
assert response.login.call_count == 1
assert response.sendmail.call_count == 1

user, pw = response.login.call_args[0]
assert pw == 'pass'
assert user == 'user@comcast.net'

mock_smtp.reset_mock()
mock_smtp_ssl.reset_mock()
response.reset_mock()

results = NotifyEmail.parse_url(
'mailtos://user:pass123@live.com')
obj = Apprise.instantiate(results, suppress_exceptions=False)
Expand Down

0 comments on commit 010be0b

Please sign in to comment.