Skip to content

Commit c6824ab

Browse files
committed
initiate starttls if port 587
1 parent 1f8ca56 commit c6824ab

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

emailMarketing/emailMarketingManager.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,10 @@ def saveSMTPHost(self):
517517

518518
try:
519519
verifyLogin = smtplib.SMTP(str(smtpHost), int(smtpPort))
520+
521+
if int(smtpPort) == 587:
522+
verifyLogin.starttls()
523+
520524
verifyLogin.login(str(smtpUserName), str(smtpPassword))
521525

522526
admin = Administrator.objects.get(pk=userID)
@@ -618,6 +622,10 @@ def smtpHostOperations(self):
618622
try:
619623
verifyHost = SMTPHosts.objects.get(id=id)
620624
verifyLogin = smtplib.SMTP(str(verifyHost.host), int(verifyHost.port))
625+
626+
if int(verifyHost.port) == 587:
627+
verifyLogin.starttls()
628+
621629
verifyLogin.login(str(verifyHost.userName), str(verifyHost.password))
622630

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

0 commit comments

Comments
 (0)