There have been a few questions recently about sending internet e-mail from aãBAJA module. I went playing about with the SOCKET_* stuff and came up withãthis module:ãã #----------------------------------------------------------#ã # demo program for sending internet e-mail via SMTP server #ã #----------------------------------------------------------#ãã !INCLUDE SBBSDEFS.INCãã STR mailserver helo_domain from_address to_addressã INT sock SMTP_portãã SET helo_domain "example.com"ã SET mailserver "mail.example.com"ã SET from_address "
sysadmin@example.com"ã SET to_address "
someuser@example.com"ã SET SMTP_port 25ãã #-------------------------------#ã # Create connection with server #ã #-------------------------------#ã SOCKET_OPEN sockã SOCKET_CONNECT sock mailserver SMTP_portãã #------------------#ã # initial dialogue #ã #------------------#ã sprintf str "helo %s\n" helo_domainã SOCKET_WRITE sock strãã sprintf str "mail from: %s\n" from_addressã SOCKET_WRITE sock strãã sprintf str "rcpt to: %s\n" to_addressã SOCKET_WRITE sock strãã SETSTR "data\n"ã SOCKET_WRITE sock strãã #---------------------------------------------------------#ã # send additional headers (like "Subject:", "Date:", etc) #ã #---------------------------------------------------------#ã SETSTR "Subject: This is a test\n"ã SOCKET_WRITE sock strãã sprintf str "To: %s\n" to_addressã SOCKET_WRITE sock strãã #----------------------#ã # send body of message #ã #----------------------#ãã SETSTR "The quick brown fox\n"ã SOCKET_WRITE sock strãã SETSTR "jumps over the lazy dog\n"ã SOCKET_WRITE sock strãã #---------------------------------------------------------#ã # terminate body of message, close connection with server #ã #---------------------------------------------------------#ã SETSTR "\n.\n"ã SOCKET_WRITE sock strãã SETSTR "quit\n"ã SOCKET_WRITE sock strã SOCKET_CLOSE sockããTrue RAABA software (RAABA = Rough As A Bruin's Bottom), so use it at yourãown risk. Basically, it connects to the SMTP server of your choice (your ISPãif you aren't running your own) and initiates a dialogue to get the mail sent.ããI say "dialogue" but it's really more of a MONOlogue. it _completely_ ignoresãwhat the server sends back, so if any problems occur it will ignore them. IOW,ãthere is NO error checking at all -- please add to taste.ããYou can see what the server responds by sticking in a SOCKET_READLINE/PRINTãpair after each SOCKET_WRITE, but when I tried that the buffer was alwaysãprefixed with a series of garbage characters. Can anybody say why/how toãavoid? If the garbage can be avoided some rudimentary error checking should beãfairly easy, since each response begins with a numeric result code that shouldãbe easily parsed to indicate success/failure.ããComments please!ãã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã