• having some problems with

    From Kernal2@VERT/CHATFREE to All on Tue Aug 21 11:20:00 2001
    I am having some problems with this program. Its not sending out the email message. Can you please tell me whats wrong with it??

    # Put all the Dim Statements here
    int minsec maxsec newsec maxtry count1 count2 sock
    str floc info1 fn fp tp1 ea sn sp mailfrom mailto cea yourdomain
    set tp1 ""
    set fn ""
    set floc ""
    set fp ""
    set cea ="0"
    set maxtry "0"
    set count1 "0"
    set count2 "0"
    set str ""
    fopen file1 O_RDONLY "c:\sbbs\exec\qtv.cfg"
    fread_line file1 floc
    fread_line file1 minsec
    fread_line file1 maxsec
    fread_line file1 newsec
    fread_line file1 yourdomain
    fread_line file1 sn
    fread_line file1 sp
    fread_line file1 mailfrom
    fread_line file1 cea
    fread_line file1 maxtry
    fclose file1
    truncsp floc
    truncsp minsec
    truncsp maxsec
    truncsp newsec
    truncsp yourdomain
    truncsp sn
    truncsp sp
    truncsp mailfrom
    truncsp cea
    truncsp maxtry
    # Create a connection with the server.

    socket_open sock
    socket_connect sock sn sp
    if_false
    print "Connection failed.\r\n"
    pause
    goto end
    end_if

    # Intial dialup
    set mailto "ptaylor10@cox.rr.com"

    sprintf str "helo %s\n" yourdomain
    #sprintf str "%s\n" yourdomain
    socket_write sock str

    sprintf str "mail from: %s\n" mailfrom
    socket_write sock str

    sprintf str "rcpt to: %s\n" mailto
    socket_write sock str

    set str "data\n"
    socket_write sock str

    # Send additional headers like subject, date ect..

    set str "Subject: Your password\n"
    socket_write sock str

    sprintf str "To: %s\n\n" mailto
    socket_write sock str

    # Send body of the message.

    set str "\n"
    socket_write sock str

    #set str "The wick brown box\n"
    printf str "This is a test\n"
    socket_write sock str

    # Terminate body of message, close connection with server


    Thank you
    Terminator


    ---
    þ Synchronet þ Synchronet -> Chatfree BBS bbs.chatfree.org
  • From Amcleod@VERT to Kernal2 on Tue Aug 21 19:03:00 2001
    RE: having some problems with
    BY: Kernal2 to All on Tue Aug 21 2001 10:20 pm

    I am having some problems with this program. Its not sending out the email message. Can you please tell me whats wrong with it??

    Well, just having a quick look at it, I note that you are putting TWO blank lines between the additional headers and the body, one as an extra \n after the "To:" address, and then one as a separate \n before the body goes out. But this won't cause it to fail -- just to add a blank line at the top of the body.

    Also, I note that the tail end of the program that closes the dialogue with the server is absent. Is it really missing, or just not included in the message? After the body is sent you need to send a "\n.\n" (newlinw-dot-newline) to mark the end of the body, and then a "quit" to sever the connection with the server (unless you want to loop back and send another message).

    if all that looks good, then I'd suggest sticking in a few lines to grab and display the response from the server so you can see what's wrong. Right after each "SOCKET_WRITE" try adding a

    SOCKET_READLINE sock str
    PRINT str

    and then run it while you watch (like ;EXEC *MODULE). You should see the responses from the server. There will be some garbage there too, but the plain-text response will also be visible after the garbage. (Anybody know what this garbage is and how to suppress/bypass it?) The responses from the server should let you know what is happening. You may need a PAUSE at the end so it doesn't disappear in a flash...

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to Kernal2 on Wed Aug 22 05:38:00 2001
    RE: having some problems with
    BY: Kernal2 to All on Tue Aug 21 2001 10:20 pm

    #set str "The wick brown box\n"
    printf str "This is a test\n"
    socket_write sock str

    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 these were obvious to me.

    -Rob

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Kernal3@VERT to Digital Man on Wed Aug 22 06:07:00 2001
    RE: having some problems with
    BY: Digital Man to Kernal2 on Wed Aug 22 2001 04:38 pm

    RE: having some problems with
    BY: Kernal2 to All on Tue Aug 21 2001 10:20 pm

    #set str "The wick brown box\n"
    printf str "This is a test\n"
    socket_write sock str

    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 the were obvious to me.

    -Rob

    I tried that is its not working.

    Here is the code I have now.

    # Intial dialup
    set mailto "ptaylor10@cox.rr.com"

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

    sprintf str "mail from: %s\n" mailfrom
    socket_write sock str

    sprintf str "rcpt to: %s\n" mailto
    socket_write sock str


    set str "data\n"
    socket_write sock str

    # Send additional headers like subject, date ect..

    set str "Subject: New password for bbs.chatfree.org\n"
    socket_write sock str

    sprintf str "To: %s\n\n" mailto
    socket_write sock str


    # Send body of the message.

    set str "\n"
    socket_write sock str

    #set str "The wick brown box\n"
    #printf str "This is a test\n"
    sprintf str "Your new password is : %s\r\n" pw1
    socket_write sock str

    # Terminate body of message, close connection with server

    set str "\r\n"
    socket_write sock str

    set str "quit\r\n"
    socket_write sock str
    socket_close sock
    Print "Message sent.\r\n"


    Do know why its not sending the email message to cox.rr.com smtp server. I am getting a connection to there server.

    Thank you
    Phil

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Amcleod@VERT to Kernal3 on Wed Aug 22 09:42:00 2001
    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: me@domain.com
    rcpt to: user@destination.com
    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 þ [vert/cvs/bbs].synchro.net