Friday, February 26, 2021

Why _thread doesnt work on the remote server?

This code works on my local server, but doesnt work on the hosting. What could be the problem?

import _thread

def email_index(*args):
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.starttls()
    server.login('ki@gmail.com', 'pas')
    try:
        server.sendmail('ki@gmail.com', 'so@gmail.com', body_mes.encode('utf-8')) print('ok')
     except:
         print('An error occurred when trying to send an email')
try:
    _thread.start_new_thread( email_index, ("Thread-1", 2, ) )
except:
    print ("Error: unable to start thread")

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ef6bd638-9d05-42ce-8de2-8397e01d9813n%40googlegroups.com.

No comments:

Post a Comment