קוד: |
msg = MIMEMultipart() msg['From'] = moneyiswork@walla.co.il msg['To'] = to msg['Subject'] = subject msg.attach(MIMEText(text, 'html', 'utf-8')) mailServer = smtplib.SMTP("out.walla.co.il",587) mailServer.ehlo() mailServer.starttls() mailServer.ehlo() mailServer.login(sender, pass) mailServer.sendmail(sender, to, msg.as_string()) mailServer.close() |
קוד: |
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host |
mksoft : |
במקרה ולא שינית: אם אתה מנסה מעל 25, אל תפעיל TLS. |
Anonymous : |
יש לך שם פונקציה starttls... מניח שיש אחת שהיא רק start בלי tls? |
Anonymous : |
ריפרפתי טיפה על התיעוד, ונשמע שאתה יכול פשוט להסיר את starttls
כדאי לעבור על התיעוד והדוגמאות, יש שם הסברים למצבים השונים. |
mksoft : |
את ה-ehlo השני אתה צריך רק במקרה של tls. אתה יכול גם לשנות את ה-debug level של ה-server כך שתקבל יותר מידע.
ראה דוגמה: https://pymotw.com/3/smtplib/#authentication-and-encryption או לפייתון 2: https://pymotw.com/2/smtplib/#authentication-and-encryption |
קוד: |
Traceback (most recent call last): File "C:\Users\costia\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\smtplib.py", line 369, in getreply line = self.file.readline(_MAXLINE + 1) File "C:\Users\costia\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\socket.py", line 378, in readinto return self._sock.recv_into(b) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:/Users/costia/PycharmProjects/untitled17/vfb.py", line 30, in <module> "שלום שלום", ) File "C:/Users/costia/PycharmProjects/untitled17/vfb.py", line 12, in mail_sender mailServer = smtplib.SMTP("out.walla.co.il", 587) File "C:\Users\costia\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\smtplib.py", line 242, in __init__ (code, msg) = self.connect(host, port) File "C:\Users\costia\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\smtplib.py", line 323, in connect (code, msg) = self.getreply() File "C:\Users\costia\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\smtplib.py", line 373, in getreply + str(e)) smtplib.SMTPServerDisconnected: Connection unexpectedly closed: [WinError 10054] An existing connection was forcibly closed by the remote host |
mksoft : |
השתמשץ בקוד בעמודים שקישרתי אליהם? הם גם מפעילים debug וכו'. |
mksoft : |
לא הדבקת את פלט ה-debug info. |
קוד: |
Traceback (most recent call last): File "C:\Users\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\smtplib.py", line 369, in getreply line = self.file.readline(_MAXLINE + 1) File "C:\Users\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\socket.py", line 378, in readinto return self._sock.recv_into(b) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:/Users/PycharmProjects/untitled17/hk.py", line 31, in <module> server = smtplib.SMTP(servername, serverport) File "C:\Users\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\smtplib.py", line 242, in __init__ (code, msg) = self.connect(host, port) File "C:\Users\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\smtplib.py", line 323, in connect (code, msg) = self.getreply() File "C:\Users\Downloads\WinPython-64bit-3.4.4.3\python-3.4.4.amd64\lib\smtplib.py", line 373, in getreply + str(e)) smtplib.SMTPServerDisconnected: Connection unexpectedly closed: [WinError 10054] An existing connection was forcibly closed by the remote host |