Skip to content

Commit

Permalink
initiate starttls if port 587
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Jul 24, 2020
1 parent 1f8ca56 commit c6824ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions emailMarketing/emailMarketingManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.'}
Expand Down

0 comments on commit c6824ab

Please sign in to comment.