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('k...@gmail.com', 'pas')
    try:
        server.sendmail('k...@gmail.com', 's...@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+unsubscr...@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.

Reply via email to