Main Menu

KB#00798-Sample Program to Send Mail Messages through PRO/5 Socket

Title:

Sample Program to Send Mail Messages through PRO/5 Socket

Description:

0001 REM YOU CAN CALL THIS PROGRAM AS: 
0002 REM CALL"MAIL.BBX","me@here.com","you@there.com","How to send email","this is great" 
0005 ENTER TO$,FROM$,SUBJECT$,MESSAGE$ 
0010 LET N0=UNT; OPEN (N0,MODE="host=mail.there.com,port=25")"N0" 
0015 REM "N0" IS A TCP SOCKET ALIAS (REV 2.20) 
0020 LET O$="",I$="220"; GOSUB MAIL 
0030 LET O$="HELO",I$="250"; GOSUB MAIL 
0035 REM FOR MORE INFORMATION ON MAIL COMMANDS CHECK OUT RFC821 
0040 LET O$="MAIL From:<"+FROM$+">",I$="250"; GOSUB MAIL 
0050 LET O$="RCPT To:<"+TO$+">",I$="250"; GOSUB MAIL 
0070 LET O$="DATA",I$="354"; GOSUB MAIL 
0080 LET O$="Subject: "+SUBJECT$+" ",I$=""; GOSUB WMAIL 
0090 LET O$="From: "+FROM$,I$=""; GOSUB WMAIL 
0100 LET O$="To: "+TO$,I$=""; GOSUB WMAIL 
0110 LET O$="Content-Type: text/html; charset=us-ascii",I$=""; GOSUB WMAIL 
0130 LET O$=$0A$,I$=""; GOSUB WMAIL 
0150 LET O$=MESSAGE$,I$=""; GOSUB WMAIL 
0240 LET O$=".",I$="250"; GOSUB WMAIL 
0250 LET O$="QUIT",I$="221"; GOSUB WMAIL 
0270 EXIT 
0280 MAIL: 
0290 IF LEN(O$) THEN LET OUT$=O$+$0D0A$; WRITE RECORD(N0)OUT$ 
0310 READ (N0,TIM=3,ERR=0320)IN$; READ (N0,TIM=3,ERR=0320)X$; LET IN$=IN$+X$ 
0321 IF LEN(I$) AND POS(I$=IN$)<>1 THEN PRINT (N0)'CR','LF'; GOTO 0300 
0330 RETURN 
0400 REM 
0480 WMAIL: 
0490 IF LEN(O$) THEN LET OUT$=O$+$0D0A$; WRITE RECORD(N0)OUT$ 
0530 RETURN 



Last Modified: 02/23/2004 Product: PRO/5

BASIS structures five components of their technology into the BBx Generations.

  Google+ View BASIS LinkedIN ProfileVisit our Twitter Feed Check out our Facebook Public Profile Click to View the BASIS youTube channel