-- TestMail.mesa; edited by HGM, 16-Feb-81 15:54:41 DIRECTORY FTPDefs USING [ FTPInitialize, FTPFinalize, FTPUser, FTPCreateUser, FTPSetCredentials, FTPDestroyUser, FTPOpenConnection, FTPCloseConnection, FTPBeginDeliveryOfMessage, FTPSendRecipientOfMessage, FTPIdentifyNextRejectedRecipient, FTPSendBlockOfMessage, FTPEndDeliveryOfMessage, PupCommunicationPrimitives], ImageDefs USING [StopMesa], OsStaticDefs USING [OsStatics], Put USING [Decimal, Line, Text], StringDefs USING [BcplToMesaString], Window USING [Handle]; TestMail: PROGRAM IMPORTS FTPDefs, ImageDefs, Put, StringDefs = BEGIN OPEN FTPDefs; server: STRING = "GV"; ftpuser: FTPUser; wh: Window.Handle = NIL; Start: PROCEDURE = BEGIN user: STRING ← [40]; serverText: STRING = [100]; FTPInitialize[]; ftpuser ← FTPCreateUser[NIL, PupCommunicationPrimitives[]]; StringDefs.BcplToMesaString[OsStaticDefs.OsStatics.UserName, user]; FTPSetCredentials[ftpuser, primary, user, NIL]; FTPOpenConnection[ftpuser, server, mail, serverText]; Put.Line[wh, serverText]; END; SendOneMessage: PROCEDURE = BEGIN SendLine: PROCEDURE [s: STRING] = BEGIN cr: WORD ← 15B*256; FTPSendBlockOfMessage[ftpuser, @s.text, s.length]; FTPSendBlockOfMessage[ftpuser, @cr, 1]; END; FTPBeginDeliveryOfMessage[ftpuser]; FTPSendRecipientOfMessage[ftpuser, "Murray"]; FTPSendRecipientOfMessage[ftpuser, "Murray.PA"]; FTPSendRecipientOfMessage[ftpuser, "Foo.PA"]; FTPSendRecipientOfMessage[ftpuser, "Murray (Hal)"]; FTPSendRecipientOfMessage[ftpuser, "Hal <Murray>"]; FTPSendRecipientOfMessage[ftpuser, "Foo@Maxc2.PA"]; CheckRejections[]; SendLine[ "To: Murray, Murray.PA, Foo.PA, Murray (Hal), Hal <Murray>, Foo@Maxc2.PA"]; SendLine["Subject: Testing"]; SendLine["Date: July 25, 1980 12:25 AM"]; SendLine["From: HGM"]; SendLine[""]; SendLine["Throw this out!"]; SendLine["Throw this out!"]; SendLine["Throw this out!"]; SendLine["Throw this out too!"]; CheckRejections[]; FTPEndDeliveryOfMessage[ftpuser]; END; SendJunkMessage: PROCEDURE = BEGIN SendLine: PROCEDURE [s: STRING] = BEGIN cr: WORD ← 15B*256; FTPSendBlockOfMessage[ftpuser, @s.text, s.length]; FTPSendBlockOfMessage[ftpuser, @cr, 1]; END; FTPBeginDeliveryOfMessage[ftpuser]; FTPSendRecipientOfMessage[ftpuser, "Foo.DLOS"]; CheckRejections[]; SendLine["To: Foo.DLOS"]; SendLine["Subject: Testing"]; SendLine["Date: 16-Feb-81 15:54:29"]; SendLine["From: HGM"]; SendLine[""]; SendLine["Throw this out!"]; SendLine["Throw this out!"]; SendLine["Throw this out!"]; SendLine["Throw this out too!"]; CheckRejections[]; FTPEndDeliveryOfMessage[ftpuser]; END; CheckRejections: PROCEDURE = BEGIN n: CARDINAL; buffer: STRING = [50]; DO [n, ] ← FTPIdentifyNextRejectedRecipient[ftpuser, buffer]; IF n = 0 THEN EXIT; Put.Text[wh, "Troubles sending to # "]; Put.Decimal[wh, n]; Put.Text[wh, ": "]; Put.Line[wh, buffer]; ENDLOOP; END; Stop: PROCEDURE = BEGIN FTPCloseConnection[ftpuser]; FTPDestroyUser[ftpuser]; FTPFinalize[]; END; Start[]; SendOneMessage[]; SendJunkMessage[]; Stop[]; ImageDefs.StopMesa[]; END.