chiadog
chiadog copied to clipboard
Email notification shouldn't require username and password
Describe the bug
https://github.com/martomi/chiadog/blob/da1a904466e6df25b930d58cefb70eca6dce4a3a/src/notifier/smtp_notifier.py#L18-L29
Currently username and password have to be specified. I use gmail SMTP relay service for all notifications as such, which doesn't require a username and password.
Proposal Remove and assign non-required arguments out of the try block:
- sender_name
- username_smtp
- password_smtp
Add a conditional here instead: https://github.com/martomi/chiadog/blob/da1a904466e6df25b930d58cefb70eca6dce4a3a/src/notifier/smtp_notifier.py#L60
something like this could suffice for now:
if self.username_smtp and self.password_smtp:
server.login(self.username_smtp, self.password_smtp)
Other Thoughts This could probably be built out a bit better over time to support other options. If the connection pieces were moved into its own function from a message builder function, that could help a bit.
Something else that probably won't work is using no encryption or ssl since that is also forced.