****************************************
* Program name: mail.cbl
* This program provides several examples
* of email statement usage.
*
* Copyright 2000 Deskware, Inc.
****************************************
*
* Include the TCP/IP variable copybook.
COPY `tcpip.cpy`.
* Program Variables
1 to_address PIC X(30).
1 from_address PIC X(30).
1 subject PIC X(40).
1 message.
5 message_text1 PIC X(100).
1 email_address PIC X(30).
1 email_password PIC X(30).
1 email_count PIC 9(05).
1 email_number PIC 9(05).
1 email_filename PIC X(20).
1 smtp_server PIC X(40).
1 pop3_server PIC X(40).
1 num_attachments PIC 9999.
1 attachment_names.
5 attachment1 pic x(20).
5 attachment2 pic x(20).
5 attachment3 pic x(20).
1 mail_to pic x(30).
1 mail_from pic x(30).
1 mail_reply_to pic x(30).
1 mail_cc pic x(30).
1 mail_date pic x(30).
1 mail_subject pic x(30).
1 mail_organization pic x(30).
1 size_of_emails pic 9(06).
* Substitute your information in for the literals below
MOVE `youremail@yourserver.com` TO email_address.
MOVE `test` TO email_password.
MOVE 1 TO email_count.
MOVE `yourserver.com` TO pop3_server.
DELETEMAIL USING email_address
email_password
`1`
pop3_server.
DISPLAY `TCPIP-RETURN-CODES: ` & TCPIP-RETURN-CODES.
DELETEMAIL USING email_address
email_password
`2`
pop3_server.
DISPLAY `TCPIP-RETURN-CODES: ` & TCPIP-RETURN-CODES.
GETMAILCOUNT USING email_address
email_password
email_count
pop3_server
size_of_emails.
DISPLAY `email_count: ` & email_count.
display `size_of_emails: ` & size_of_emails.
DISPLAY `TCPIP-RETURN-CODES: ` & TCPIP-RETURN-CODES.
GOBACK.