address = "*****@mail.ru" msg = MIMEMultipart() msg['Subject'] = ( user_name + ' ' + str(date)) msg['From'] = str(address) msg['To'] = str(address) files = [file1, file2, file3] for x in files: filepath = x basename = os.path.basename(filepath) # Compose attachment part = MIMEBase('application', "octet-stream") part.set_payload(open(filepath, "rb").read()) Encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % basename) msg.attach(part) # Send mail smtp = SMTP_SSL() smtp.connect('smtp.mail.ru:465') smtp.login(str(address), 'password') smtp.sendmail(str(address), str(address), msg.as_string()) smtp.quit()
smtplib.SMTPAuthenticationError: (501, ‘Syntactically invalid EHLO argument(s)’)
Жалуется на строку:
smtp.login(str(address), ‘password’)
На других компьютерах работает, а на моем нет.