From 77ec25ab6cb943620ca00835bee3d42e9c137b5e Mon Sep 17 00:00:00 2001 From: Neal Fultz Date: Tue, 15 Jan 2019 03:53:14 +0000 Subject: [PATCH] Only login if credentials supplied --- nb2mail/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nb2mail/__init__.py b/nb2mail/__init__.py index 2a731d2..1cf3196 100644 --- a/nb2mail/__init__.py +++ b/nb2mail/__init__.py @@ -146,7 +146,9 @@ def postprocess(self, input): smtpserver = smtplib.SMTP(self.smtp_addr,self.smtp_port) smtpserver.ehlo() smtpserver.starttls() - smtpserver.login(self.smtp_user, self.smtp_pass) + + if self.smtp_user and self.smtp_pass: + smtpserver.login(self.smtp_user, self.smtp_pass) with open(input) as f: email = Parser().parse(f)