//smtpTest1.dxl /* Script to test ability to send outgoing SMTP mail 01/26/01 rngallion DOORSPC5.0 Original release */ const int RECV_TIMEOUT = 5 // recv timeout in seconds const int SMTP_SERVER_PORT = 25 const string SMTP_SERVER_HOSTNAME = "207.108.112.1" const string SMTP_CLIENT_HOSTNAME = "roger.gallion.net" const string SENDER_EMAIL_ADDRESS = "rgallion@madisontelco.com" const string RECIPIENT_EMAIL_ADDRESS = "krhunt" IPC ipc = null string response // ___________ void haltOnError (string errorMessage) { if (! null errorMessage) { errorBox errorMessage if (! null ipc) { disconnect ipc delete ipc } halt } } // ________ void smtpRecv () { if (! recv (ipc, response, RECV_TIMEOUT)) { haltOnError "smtpRecv: recv failed" } else { print "Recv: " response } } // ____________ void smtpSend (string request) { if (! send (ipc, request)) { haltOnError "smtpSend: send '" request "' failed" } else { print "Sent: " request } } // ____________ void smtpSendRecv (string request) { smtpSend request smtpRecv } // ______________ void smtpDisconnect () { if (null ipc) return disconnect ipc delete ipc ipc = null } // ___________ void smtpConnect () { ipc = client (SMTP_SERVER_PORT, SMTP_SERVER_HOSTNAME) if (null ipc) haltOnError "smtpConnect: null ipc!" smtpRecv } smtpConnect smtpSendRecv "HELO " SMTP_CLIENT_HOSTNAME "\r\n" smtpSendRecv "MAIL FROM: <" SENDER_EMAIL_ADDRESS ">\r\n" smtpSendRecv "RCPT TO: <" RECIPIENT_EMAIL_ADDRESS ">\r\n" smtpSendRecv "DATA\r\n" smtpSendRecv "Yet another test\r\n.\r\n" smtpSendRecv "QUIT\r\n" smtpDisconnect endRecv