Email System Variables

You can use Email system variables within an Email automation task to manage your email automation loop. These variables are specific to the scope of the loop that processes each email message for the server.

Manage your email automation using the e-mail variable.

Note: Applicable only for the Loop command: Each Email Message on Mail Server.

For EWS, the Email Received Time variable does not include the offset value.

When you use the Loop/Email automation command (see example below), a comment in the task explains how you can use these system-defined variables.

Example 1:

  1. Start Loop "Each message on server: mail.automationanywhere.com,User Name: https://support.automationanywhere.com, ServerType: IMAP, Message Format: HTML"
  2. Comment: Please enter your commands to loop. Use Email Automation variables for each email on Server (For example: $Email From$, $Email To$, etc.)
  3. End Loop

Example 2:

In below example we extract emails from in-box and store them in text files. This type of task can be scheduled and emails can be retrieved offline.

  1. Start Loop "5" Times
  2. Comment: Please enter your commands to loop.
  3. Start Loop "Each message on server: imap.gmail.com, User Name: admin1, SSL, ServerType: IMAP, Message Format: HTML"
  4. Comment: Please enter your commands to loop. Use system variables for each email on Server.(For example: $Email From$, $Email To$, etc.)
  5. Log to File: $Email From$ John in "D:\Desktop\1.txt"
  6. Message Box: "$Email Subject$ $Email From$"
  7. Variable Operation: Reset: $Email From$
  8. Message Box: "$Email Subject$"
  9. Variable Operation: Reset: $Email Subject$
  10. End Loop
  11. End Loop

The variables in this example can be reset using the Variable Operation (System Variable) command. The drop-down menu offers all of the options for resetting.