The G4GLSTMM command is used to list and retrieve email messages associated with a specific GMail Account

The following files will be populated after each call.

  • G4GMHPF - This is the GMail Header file. For each message retrieved this file will contain the Google ID, Message ID, and a short snippet of the message
  • G4GMHHPF - This is the GMail Header "Header" file. For each message retrieved this file will contain one entry for each header and the header value associated with the email. Headers are things like subject, to, from, etc.
  • G4GMHLPF - This is the GMail Header "Label" file. For each message retrieved this will contain one or more values that represent the labels associated with that particular message. Labels are things like INBOX, SENT, TRASH or any customer labels you may have created. To get the description of each label you will need to use the G4GLSTML command to list the available labels and their descriptions.
  • G4GMMPF - This is the GMail Message file. For each message retrieved there will be a record and the label it was retrieved from.
  • G4GMBPF - This is the GMail Message Body file. For each email that contains a "body" a record will be added here with a link to the stream file that the body is placed in. Normally a record will only be placed in this file when the email message is a plain text email with no attachments, images or other parts.
  • G4GMPPF - This is the GMail Message "Part" file. When messages are retrieved each piece of it, including attachments and embedded images, etc, are known as "Parts". This file will contain one record for each part associated with each message retrieve. With most modern emails that are sent as text and html (multi-part) the actual content or message will be in one or more "parts".

Preceding each call each of the files listed will be cleared and any files (messages, parts, bodies, attachments, etc) will be removed if they are still in the located specified.

                          List GMail Messages (G4GLSTMM)        
 Type choices, press Enter.
 Google ID  . . . . . . . . . . . ______________________________________________
 Label ID . . . . . . . . . . . . ______________________________________________
 Include Spam and Trash . . . . .   *NO           *YES, *NO
 Retrieve New Messages Only . . .   *YES          *YES, *NO
 Retrieve Message Parts . . . . .   *YES          *YES, *NO
 Retrieve Message Attachments . .   *YES          *YES, *NO
 Mark Messages as Read  . . . . .   *YES          *YES, *NO
 Move to Folder . . . . . . . . .   *NONE     
                            Additional Parameters                              
 Message Query  . . . . . . . . .
 Temporary Directory  . . . . . .   '/tmp'
 Maximum Part Size  . . . . . . .   0             0-16773104 
 CCSID  . . . . . . . . . . . . .   1252          Number
 Debug  . . . . . . . . . . . . .   *NO           *YES, *NO
 Debug File . . . . . . . . . . .
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display   
 F24=More keys                                                                 
  • Google ID - Enter the Google ID you wish to retrieve messages for
  • Label ID - Enter the label ID to retrieve messages from. If this value is left blank, messages will be retrieved from every label. Valid label IDs will be in the G4GMLPF file after running the G4GLSTML command.
  • Include Spam and Trash - Specify if when receiving email messages you'd like to retrieve messages marked as Spam or Trash.
  • Retrieve Message Parts - Specify is you wish to retrieve message parts (such as embedded images, attachments, etc) when retrieving the message. This will not actually download attachments, but it will get references to them.
  • Retrieve Message Attachments - Specify if you wish to download message attachments associated with the file. If you specified *NO for Retrieve Message Parts this is ignored and no attachments will be downloaded.
  • Mark Messages as Read - Specify if after the process is completed you wish to mark each message as read.
  • Move to Folder - Specify a folder ID to move messages to once they have been retrieved. This is only valid when specifying a Label ID to retrieve messages from.
  • Message Query - Enter a custom message query. This query is not checked for syntax and should follow the specifications from Google.
  • Temporary Directory - Specify the temporary directory to use for message parts, files and attachments. This must be a fully qualified path to an existing directory (ie, /myfiles/myemails/downloads).
  • Maximum Part Size - Specify the maximum part size (in bytes). If a part of an email is larger than this value it will not be downloaded. It will be logged in the G4GMPPF file with an error code of SIZE_LIMIT. The default when this value is 0 is 16m. The size of the object reported by the API will be about 1.4 times larger than the actual size since the data is Base 64 encoded, so you may want to take that into account when specifying a size limit.
  • CCSID - Enter a CCSID for data translation.
  • Debug - Enter *YES to debug this command.
  • Debug File - Enter the fully qualified path and name of the IFS file to store the debug data. If left blank the default of /tmp/g4g_<id>_listMessagesDebug.txt
  • will be used where <id> is the ID associated with the request.