Tk Library Source Code

View Ticket
Login
Ticket UUID: 985839
Title: Can't send mail to Yahoo
Type: Bug Version: None
Submitter: phantomfive Created on: 2004-07-06 09:29:07
Subsystem: smtp Assigned To: mrose
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-08-06 20:37:50
Resolution: Fixed Closed By: patthoyts
    Closed on: 2004-08-06 13:37:50
Description:
Using the smtp and mime packages to send email, I am
having trouble sending email to Yahoo using Windows XP.
 It works fine from a Linux machine, also sending mail
from the windows machine to hotmail.com works.  I am
using the following code:

proc send_simple_message {recipient email_server
subject body} {
    package require smtp
    package require mime
    
    set token [mime::initialize -canonical text/plain \
   -string $body]
    mime::setheader $token Subject $subject
    
    puts [smtp::sendmessage $token \
      -recipients $recipient -servers $email_server]
    mime::finalize $token
}
send_simple_message [email protected]
mx3.mail.yahoo.com \
    "This is the subject." "\n\n This is the message.\n"


It gives me an error:

key message-id not in header
   while executing 
"error "key $mixed not in header""

This appears to be on line 1282 of mime.tcl.

I tried to add things to the header with the following
code inside proc send_simple_message:

mime::setheader $token Subject $subject
mime::setheader $token Message-ID \
"<3140374180748234979238742391784313234@localhost>"
mime::setheader $token Date "July 4, 2004"
    


And I ended up with the following error:

can't unset "state(route)": no such element in array
while executing 
"unset state($prop)"

This appears to be referring to line 2675 of mime.tcl
(I would expect that the catch would take care of the
error, but apparently not).
User Comments: patthoyts added on 2004-08-06 20:37:49:
Logged In: YES 
user_id=202636

Seems fixed.

phantomfive added on 2004-07-09 09:27:42:
Logged In: YES 
user_id=1076637

The problem is fixed if I add the "From" field to the
header.  When I send mail to hotmail the "From" field is
added automatically, but sending mail to yahoo throws the
error if there is no "From" field.

I downloaded the latest versions of mime.tcl and smtp.tcl
off the CVS last saturday (July 3rd).  Previously I had been
using mime.tcl 1.4 and smtp 1.3.5 that came with the active
tcl distribution.

patthoyts added on 2004-07-09 05:51:58:
Logged In: YES 
user_id=202636

Their mail server isn't that wierd. It appears to be RFC2821
compliant at least.

Here is what I'm using to test this:
 proc send {from to msg {server localhost} {port 25}} {
    set tok [mime::initialize -canonical text/plain -string
$msg]
    smtp::sendmessage $tok -debug 1 \
        -servers [list $server] \
        -ports [list $port] \
        -header [list From "$from"] \
        -header [list To "$to"] \
        -header [list Subject "RFC 2821 test"] \
        -header [list Date "[clock format [clock seconds]]"]

    mime::finalize $tok
 }

Note the -debug 1 -- this lets you check the SMTP
conversation. For which I get
Trying mx3.mail.yahoo.com...
<-- 220 YSmtp mta260.mail.scd.yahoo.com ESMTP service ready
--> EHLO zen (wait upto 300 seconds)
<-- 250-mta260.mail.scd.yahoo.com
<-- 250-8BITMIME
<-- 250-SIZE 15990784
<-- 250 PIPELINING
--> MAIL FROM:<[email protected]> SIZE=265
(wait upto 600 seconds)
<-- 250 sender <[email protected]> ok
--> RCPT TO:<[email protected]> (wait upto 3600 seconds)
<-- 250 recipient <[email protected]> ok
--> DATA (wait upto 300 seconds)
<-- 354 go ahead
--> . (wait upto 120 seconds)
<-- 250 ok dirdel
--> QUIT (wait upto 120 seconds)
<-- 221 mta260.mail.scd.yahoo.com

So it's not the yahoo server - it's something in the mime
package -- perhaps you have an old version? I'm testing with
mime 1.4 and smtp 1.4 here.

phantomfive added on 2004-07-07 13:19:42:
Logged In: YES 
user_id=1076637

An addendum:  The windows and linux machines are behind a
firewall and are being masquaraded to a different ip
address.  I don't know if that matters.
Also, yahoo has a strange mail server.