Subj : having some problems with
To   : Kernal3
From : Amcleod
Date : Wed Aug 22 2001 01:42 pm

RE: having some problems with
BY: Kernal3 to Digital Man on Wed Aug 22 2001 05:07 pm

>  > I think you mean sprintf here (not printf). Also, SMTP command should be
>  > terminated with "\r\n" (not just "\n"). There may be other problems, but
>  > were obvious to me.

I used "\n" in my test module and sent myself mail perfectly via the company
SMTP server (sendmail).   Maybe some servers are more tolerant?

> sprintf str "helo %s\n" yourdomain
> socket_write sock str
> socket_readline sock str
> print str

You couldput a SOCKET_READLINE/PRINT after _every_ SOCKET_WRITE so you can see
where the dialogue goes bad.  Anyway...

> # Terminate body of message, close connection with server
> set str "\r\n"
> socket_write sock str
> set str "quit\r\n"
> socket_close sock

You are not actually terminating the message, so when you SOCKET_CLOSE the
connection is reset and the server drops everything you've done so far on the
floor with a clang.

After you send "data", everything you send is considered part of the message
until you explicitly terminate the message text.  You do this by sending a line
consisting of a full-stop by itself.  IOW "\n.\n" after the message body.  If
you don't do this (and your code DOESN'T do this) the "quit" will become just
another line in the message.  Then the SOCKET_CLOSE breaks the connection
_before_ the message is completed -- so the server discards it.  You need to
send in all:

   helo domain.com
   mail from: [email protected]
   rcpt to: [email protected]
   data
   <additional headers and
   body of message goes here,
   as many lines as you like>
   .
   quit

You HAVE to send the dot before the "quit".  On a line by itself.

---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net