Get E-mail Action
<AMPOP3MAIL ACTION="text" RESULTDATASET="test" ATTACHMENTDEST="text" SAVEMODE="text [options]" HOST="text" USER="text" PASSWORD="text" REMOVEMESSAGE="yes/no" PROXYTYPE="text" PROXYHOSTNAME="text" PROXYPORT="number">
Retrieves and/or removes e-mail messages from a POP3/IMAP/WEBDAV (Exchange Server) mail box. A dataset is created and populated with the message information. The dataset can be scanned using the Loop Dataset action and accessed by referencing %datasetname.field%. Note that messages will be processed even if they have already been processed unless the Remove mail from server parameter is checked.
Commonly used to build an automated e-mail attendant. Can automatically download and detect content of messages. Based on the content of the messages, an automated reply (using Send EMail) could be made or data could be written to a database (using SQL Query).
Specifies the action that should take place during execution. The available options are:
Get all headers (faster): Retrieves all message headers (subject, date, to and from information). This is a fast and efficient way to determine what is on the server without downloading potentially large message bodies and/or attachments.
Get all messages: Retrieves all messages, including message headers, bodies and attachments. This could take a long time if on a slow connection or if there are messages containing large attachments or large amount of data in the message body.
Get single message: Retrieves a single message as indicated in the Message ID / Message sequence number parameter. Message ID's or sequence numbers can be retrieved by downloading headers only first (using Get all headers).
Delete all messages: Clears the target mailbox by deleting all messages found on the specified server.
Delete single message: Deletes/removes a single message as designated in the Message ID / Message sequence number parameter. Message ID's or sequence numbers can be retrieved by downloading headers only first (using Get all headers).
If retrieving messages, specifies that messages should be removed (deleted) from the server after they are downloaded. This option is ignored if the Action to take parameter is set to Delete all messages or Delete single message.
If the Action to take parameter is set to Get all messages or Get single message, specifies that any corresponding attachments will be downloaded along with the message.
Specifies the address of the mail server. This can be a host and domain name or IP address.
Specifies the username that should be used when logging on to the Server.
Specifies the password that should be used when logging on to the Server. The Username should be preconfigured at the server level. When the step is created using the Task Builder it is written to the task encrypted.
Name of the dataset that should be created and populated with the mail message data upon execution. To access the data in subsequent steps simply specify %DATASETNAME.FIELDNAME% inside a Loop Dataset <AMLOOPDATASET> action (to recurse the rows). See Notes below for more information.
Specifies the Message ID or index of the message to act on. This parameter is only valid if the Action to take parameter is set to Get single message or Delete single message.
Specifies the protocol type to use. The available options are:
WEBDAV (EXCHANGE SERVER)
NOTE: Certain parameters may or may not be available depending on the protocol type selected.
Specifies the type of security protocol the mail server uses. This parameter is unavailable if the protocol type selected is WEBDAV (EXCHANGE SERVER). The available options are:
Specifies the port that should be used to connect to the mail server. When selecting POP3 as the protocol type, this parameter is set to port 110 as default. When selecting IMAP as the protpcol type, this parameter is set to port 143 as default. However, this parameter can be customized to allow the other port numbers. This parameter is unavailable if the protocol type selected is WEBDAV (EXCHANGE SERVER).
Specifies the Exchange Server mailbox URL used to be used. This parameter is available only if the protocol type selected is WEBDAV (EXCHANGE SERVER).
Specifies the Exchange Server domain name to be used. This parameter is available only if the protocol type selected is WEBDAV (EXCHANGE SERVER).
Specifies the current folder in which to retrieve e-mail messages from. The default folder that should be entered is normally Inbox. However, this parameter can be customized to specify a particular sub-folder to retrieve messages from. For example: Inbox/Support. This parameter becomes available only if the protocol type selected is IMAP.
Specifies the full path and filename of the certificate (.cer or .pfx extension) used to authenticate with. This parameter is available only if the protocol selected under the Security parameter is Explicit TLS/SSL or Implicit TLS/SSL.
Specifies the password or passphrase which corresponds to the certificate entered (certificates with .pfx extensions may include a password/passphrase). This parameter is available only if the protocol selected under the Security parameter is Explicit TLS/SSL or Implicit TLS/SSL.
If a server SSL certificate is issued by unknown or invalid certificate authority, AutoMate may generate an error. If this parameter is enabled, AutoMate will automatically ignore any invalid server certificate it detects. This parameter is available only if the protocol selected under the Security parameter is Explicit TLS/SSL or Implicit TLS/SSL.
Specifies the folder into which attachments should be saved.
Specifies how to handle an attachment if one already exists with the same filename.
The available options are:
Do not save: The new file with the same file name is not saved and the original file is retained. (default)
Save with unique file name: The file is renamed to a unique filename before saving. The unique file name will include an underscore "_" followed by a number appended to the original file name. For example, if the original file is named theFile.txt, the new file name will be theFile_1.txt. The new file name will appear in the dataset results.
Overwrite existing file: The original file is overwritten with the new one.
NOTE: Filters tab settings are available only when the Action to take parameter located in the General tab is set to Get all messages or Delete all messages. This allows retrieval or removal of particular e-mail messages which match only the filter(s) specified. To specify more than one item per field, use wildcards (i.e. * or ?). For example, to specify all From recipients within a specific domain, enter *@networkautomation.com in the From field.
Specifies whether messages with or without attachments should be retrieved/deleted. The available options are:
Doesn't Matter (default)
Specifies that only messages newer than the date/time specified will be retrieved/deleted.
Specifies that only messages older than the date/time specified will be retrieved/deleted.
Specifies proxy protocol that should be used. If you are unsure of the value to use in this parameter, contact your network administrator.
The available options are:
System Default (default, recommended): The settings specified in the Task Administrator preferences are used.
None: Explicitly instructs the action not to use a proxy server regardless of the system default
Socks 4: Instructs the action to go through a Socks 4 compliant server
Socks 4a: Instructs the action to go through a Socks 4a compliant server
Socks 5: Instructs the action to go through a Socks 5 compliant server
Note: To create the most portable tasks it is best to specify "system default" and specify proxy settings in the Preferences of the Task Administrator (Proxy Tab). By proceeding this way, tasks created in one environment that may have a proxy server will be portable to others that do not - and vice-versa.
Specifies the port that should be used to connect to the proxy server. Most proxy servers operate on port 1028 (the default) however the proxy server can be customized to operate on other ports
Specifies the hostname (server.domain.com) or IP address (xxx.xxx.xxx.xxx) of the proxy server.
Specifies the username that should be used to authenticate when connecting through the proxy server. This option is only valid when Socks 5 is specified in the Proxy type as it is the only version that supports authentication.
Specifies the password that should be used to authenticate when connecting through the proxy server. When the step is created using the Task Builder it is written to the task encrypted. This option is only valid when Socks 5 is specified in the Proxy type as it is the only version that supports authentication.
A dataset is a multiple column, multiple row container object. This action creates and populates a dataset with the following fields:
along with the standard fields included in every dataset
A record (row) is created for each mail message that is retrieved from the server. To access this data use the Loop Dataset Action to loop through the records, inside the loop you can extract the data from the field of your choice (from the current record) by using an embedded expression as follows:
This can be used in any parameter in any action. So, to display the data in a message box the AML code would look like this:
<AMMESSAGEBOX MESSAGETEXT="%mydatasetname.subject%" WINDOWTITLE="The Subject of the message is">
At runtime the text %mydatasetname.subject% is replaced by the contents of the subject of the current record.
More on datasets
This action includes the Description tab for entering a custom step description.
More on setting custom step description
This action also includes the standard Error Causes and On Error failure handling options/tabs.
More on Error Handling Options
All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.
More on variables
More on expressions
More on the expression builder
NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.
<AMPOP3MAIL ACTION="all_messages" RESULTDATASET="MAILMESSAGES" ATTACHMENTDEST="c:\messageattachments" SAVEUNIQUE="YES" HOST="mail.server.com" USER="myusername" PASSWORD="
<AMMESSAGEBOX MESSAGETEXT="The current message subject is %mailmessages.subject%." WINDOWTITLE="Current Message %mailmessages.CurrentRow%">