Skip to content
Permalink
Browse files
initiate starttls if port 587
  • Loading branch information
usmannasir committed Jul 24, 2020
1 parent 1f8ca56 commit c6824aba620acb2f7485850a78a387b57bb70880
Showing 1 changed file with 8 additions and 0 deletions.
@@ -517,6 +517,10 @@ def saveSMTPHost(self):

try:
verifyLogin = smtplib.SMTP(str(smtpHost), int(smtpPort))

if int(smtpPort) == 587:
verifyLogin.starttls()

verifyLogin.login(str(smtpUserName), str(smtpPassword))

admin = Administrator.objects.get(pk=userID)
@@ -618,6 +622,10 @@ def smtpHostOperations(self):
try:
verifyHost = SMTPHosts.objects.get(id=id)
verifyLogin = smtplib.SMTP(str(verifyHost.host), int(verifyHost.port))

if int(verifyHost.port) == 587:
verifyLogin.starttls()

verifyLogin.login(str(verifyHost.userName), str(verifyHost.password))

data_ret = {"status": 1, 'message': 'Login successful.'}

0 comments on commit c6824ab

Please sign in to comment.