chiadog icon indicating copy to clipboard operation
chiadog copied to clipboard

Email notification shouldn't require username and password

Open kungfoome opened this issue 3 years ago • 0 comments

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.

kungfoome avatar May 10 '21 03:05 kungfoome