Issue2840

classification
Title: smtplib.sendmail() does not work for mails bigger than 64 KiB
Type: crash Severity: normal
Components: Core, Library Versions: Jython 2.7.1, Jython 2.7.2
Milestone: Jython 2.7.3
process
Status: open Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: jeff.allen, r_walter, zyasoft
Priority: normal Keywords:

Created on 2019-11-25.14:51:35 by r_walter, last changed 2020-03-02.08:13:39 by jeff.allen.

Files
File name Uploaded Description Edit Remove
mytest_smtplib.py r_walter, 2019-11-25.14:51:34
double_rainbow.jpg r_walter, 2019-11-25.14:53:07 Picture used as attachment in the script
Messages
msg12796 (view) Author: Roland Walter (r_walter) Date: 2019-11-25.14:51:34
I tried to send an email with jython 2.7.1 and jython 2.7.2b2 with the attached mytest_smtplib.py. The attached image is 85 KiB in size.
The OS is openSUSE Leap 15.1. The java version is 1.8.0_222.

The program fails with:

Traceback (most recent call last):
  File "mytest_smtplib.py", line 40, in <module>
    s.sendmail(sender, receiver, msg.as_string())
  File "/usr/local/jython2.7.1/Lib/smtplib.py", line 745, in sendmail
    self.rset()
  File "/usr/local/jython2.7.1/Lib/smtplib.py", line 469, in rset
    return self.docmd("rset")
  File "/usr/local/jython2.7.1/Lib/smtplib.py", line 393, in docmd
    self.putcmd(cmd, args)
  File "/usr/local/jython2.7.1/Lib/smtplib.py", line 341, in putcmd
    self.send(str)
  File "/usr/local/jython2.7.1/Lib/smtplib.py", line 331, in send
    raise SMTPServerDisconnected('Server not connected')
smtplib.SMTPServerDisconnected: Server not connected

The log of the postfix mailserver shows:

2019-11-25T15:15:58.762073+01:00 dios postfix/smtpd[14421]: connect from localhost[127.0.0.1]
2019-11-25T15:15:59.066917+01:00 dios postfix/smtpd[14421]: 104A2A08C1: client=localhost[127.0.0.1]
2019-11-25T15:15:59.126283+01:00 dios postfix/cleanup[14434]: 104A2A08C1: message-id=<20191125141559.104A2A08C1@dios.nixdos.de>
2019-11-25T15:20:59.227259+01:00 dios postfix/smtpd[14421]: timeout after DATA (65507 bytes) from localhost[127.0.0.1]
2019-11-25T15:20:59.227865+01:00 dios postfix/smtpd[14421]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=0/1 commands=3/4


But the same program works with python.
msg12798 (view) Author: Roland Walter (r_walter) Date: 2019-11-25.14:53:07
I added the picture used as an attachment.
msg12826 (view) Author: Jeff Allen (jeff.allen) Date: 2019-12-13.07:37:01
We should be able to do better than that. Aiming for 2.7.2
msg12928 (view) Author: Jeff Allen (jeff.allen) Date: 2020-01-26.14:09:41
This is quite likely connected with the incomplete nature of our socket implementation, see for example https://github.com/jythontools/jython/issues/104, and I do not think a fix is feasible in the timescale of the 2.7.2 release.
History
Date User Action Args
2020-03-02 08:13:39jeff.allensetmilestone: Jython 2.7.3
2020-01-26 14:09:41jeff.allensetnosy: + zyasoft
messages: + msg12928
milestone: Jython 2.7.2 -> (no value)
2019-12-13 07:37:01jeff.allensetpriority: normal
resolution: accepted
messages: + msg12826
nosy: + jeff.allen
milestone: Jython 2.7.2
2019-11-25 14:53:07r_waltersetfiles: + double_rainbow.jpg
messages: + msg12798
2019-11-25 14:51:35r_waltercreate