Skip to content

Commit

Permalink
Smtp/#210 disable login (#266)
Browse files Browse the repository at this point in the history
* made login to smtp server optional. Closes #210

* updated docs

* updated docs

* added pr issue to changelog

* updated changelog
  • Loading branch information
liiight committed Jun 24, 2019
1 parent 0204c81 commit 25a1695
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion notifiers/providers/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class SMTP(Provider):
"type": "boolean",
"title": "should the email be parse as an HTML file",
},
"login": {"type": "boolean", "title": "Trigger login to server"}
},
"dependencies": {
"username": ["password"],
Expand All @@ -96,6 +97,7 @@ def defaults(self) -> dict:
"tls": False,
"ssl": False,
"html": False,
"login": True,
}

def _prepare_data(self, data: dict) -> dict:
Expand Down Expand Up @@ -134,7 +136,7 @@ def _connect_to_server(self, data: dict):
self.smtp_server.ehlo()
self.smtp_server.starttls()

if data.get("username"):
if data["login"] and data.get("username"):
self.smtp_server.login(data["username"], data["password"])

@staticmethod
Expand Down
10 changes: 8 additions & 2 deletions source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
Changelog
=========

Dev (Unreleased)
----------------
1.2.0 (Unreleased)
------------------

- Added ability to cancel login to SMTP/GMAIL if credentials are used (`#210 <https://github.com/notifiers/notifiers/issues/210>`_, `#266 <https://github.com/notifiers/notifiers/pull/266>`_)

1.0.4
------

- Added `black <https://github.com/ambv/black>`_ and `pre-commit <https://pre-commit.com/>`_
- Updated deps

1.0.0
-----
Expand Down
3 changes: 3 additions & 0 deletions source/providers/email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ Full schema:
username:
title: username if relevant
type: string
login:
title: Trigger login to server
type: boolean
required:
- message
- to
Expand Down

0 comments on commit 25a1695

Please sign in to comment.