5.22.4 GET

The GET command retrieves email details from the mail server. The GET command is usually used repetitively to get all the messages and appropriate information pertaining to the messages.

Syntax:

Command

Keyword

Value

Developer notes

GET

OBJECT

*MESSAGECOUNT

A value of *MESSAGECOUNT will return the number of messages in the folder in the JSM command message parameter.

*FIRSTMESSAGE

A value of *FIRSTMESSAGE sets the current message to the first message in the folder. If no message is available, the command status field is set to NOMAIL.

*NEXTMESSAGE

This value will get the next mail message in the folder and set this as the current message. If there are no more messages the command status field is set to NOMAIL. If a message is found the command status is returned as OK.

The *NEXTMESSAGE processing is usually followed by another GET command to retrieve the details of the message e.g. the subject, from address or attachments, or the SAVE command to get the actual body of the message.

*TOADDRESS

Returns the email address of the email recipient(s) into the JSM command message parameter or, if a list is provided, into the working list.

*CCADDRESS

Returns the email address of the email recipient(s) into the JSM command message parameter or, if a list is provided, into the working list.

*FROMADDRESS

Returns the email address of the email sender into the JSM command message parameter or, if a list is provided, into the working list.

*SUBJECT

Returns the subject of the current message in the JSM command message parameter.

*SENTDATE

Returns the date the email was sent in the JSM command message parameter.

*ATTACHMENTS

Returns a working list with an entry detailing the file name of each attachment on the current email.

*UID

Returns the unique identifier of the current message.

*HEADER

Use the keyword FIELD to specify which MIME header field is to be returned.

 

Example

GET OBJECT(*SUBJECT)

 

GET OBJECT(*FROMADDRESS)

 

GET OBJECT(*NEXTMESSAGE)

 

GET OBJECT(*ATTACHMENTS) #WRKLST(NAME)