Tk Library Source Code

View Ticket
Login
Ticket UUID: 827436
Title: smtp::sendmail does not send correct ending sequence
Type: Bug Version: None
Submitter: col_ford Created on: 2003-10-21 10:59:03
Subsystem: mime Assigned To: mrose
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-11-07 04:11:33
Resolution: Fixed Closed By: patthoyts
    Closed on: 2006-11-06 21:11:33
Description:
I've been using the smtp::sendmail and mime types to
send attachements (base64 encoded). The system I use is
Windows 2000. 

I use the SMTP server which comes with Windows 2000
IIS. When ending a SMTP mail the server expects the
sequence 

<CR><LF>.<CR><LF>

the sent sequence is just "."

If I change line 1254 in smtp.tcl from:

set result [talk $token $secs .]

to 

set result [talk $token $secs "\r\n.\r\n"]

the SMTP server correctly registers the end sequence
and sends the mail. 

Now I'm not sure that this is a bug with the SMTP
server deviating from the standards or the tcl module
not listening to what the end sequence should be.
User Comments: patthoyts added on 2006-11-07 04:11:33:
Logged In: YES 
user_id=202636

The problem shows up when you send a very short text mail using
 set tok [mime::initialize -canonical text/plain -string "body"]
 smtp::sendmail -server localhost $tok \
   -header {From root} -header {To root} -header {Subject
testing}
On unix systems with a tls capable sendmail this hangs up
waiting for the SMTP data termination sequence (CRLF.CRLF)
I've applied a patch that fixes the problem only for mail
bodies that do not already have a terminating LF. The
problem does not show up when Trf is used to process the
body data.

andreas_kupries added on 2004-05-18 03:41:00:
Logged In: YES 
user_id=75003

Marshall, any progress on this front ?

col_ford added on 2003-10-28 17:37:38:
Logged In: YES 
user_id=891419

Below is the tcl that I'm am using to contstruct the
message. It tries to construct a message with a body and
four attachments - the last being a binary file.

set body_mime[ mime::initialize  -canonical text/plain
-param [ list charset us-ascii ] -encoding 7bit -string $body ]

set log_mime [ mime::initialize -canonical text/plain -file
$log_file -header [ list Content-Disposition inline ] -param
[ list name $log_file_d ] -param [ list filename $log_file_d
] -encoding 7bit ]

set yuma_mime [ mime::initialize -canonical text/plain -file
$yuma_file -header [ list Content-Disposition inline ]
-param [ list name $yuma_file_d ] -param [ list filename
$yuma_file_d ] -encoding 7bit ]

set ephem_mime[ mime::initialize -canonical text/plain
-file $eph_file -header [ list Content-Disposition inline ]
-param [ list name $eph_file_d ] -param [ list filename
$eph_file_d ] -encoding 7bit ]

set data_mime[ mime::initialize -canonical
application/octet-stream -file "$OUT_FILE_NAME"  -header [
list Content-Disposition attachment ] -param [ list name
$scn_file ] -param [ list filename $scn_file ] -encoding
base64 ]

set multiT [ mime::initialize -canonical multipart/mixed
-parts [ list $body_mime $log_mime $yuma_mime $ephem_mime
$data_mime ]]

smtp::sendmessage $multiT \
-header [ list From $ADMIN_EMAIL ] \
-header [ list To $XML_DATA(email) ] \
-header [ list Subject $SUBJECT_EMAIL ] \
-servers $SMTP_SERVER

mrose added on 2003-10-22 04:55:49:
Logged In: YES 
user_id=24077

if the object being sent doesn't end in \r\n, then the code in question 
will fail. however, the patch you propose will append a newline to 
well-formed messages. what, exactly, are you providing as the 
argument to the smtp::sendmessage function?