Email - Get message(s)
Declaration
<AMEMAIL ACTIVITY="all_messages" SESSION="text" PROTOCOLTYPE="text (options)" EMAILADDRESS="text" USEHTTP="YES/NO" SERVER="text" PORT="number" AUTODISCOVERURL="YES/NO" IMPERSONATE="YES/NO" AUTHTYPE="text (options)" USERNAME="text" PASSWORD="text (encrypted)" DOMAINNAME="text" TENANTID="text (encrypted)" CLIENTID="text (encrypted)" CLIENTSECRET="text (encrypted)" CURRENTFOLDER="text" TIMEOUT="number" SECURITY="text (options)" CERTIFICATE="text" CERTIFICATEPASSPHRASE="text (encrypted)" IGNOREINVALIDCERTIFICATE="YES/NO" TLSCIPHERS="text (options)" TLSVERSIONS="text (options)" PROXYTYPE="text (options)" PROXYSERVER="text" PROXYPORT="number" PROXYUSERNAME="text" PROXYPASSWORD="text (encrypted)" RESULTDATASET="text" REMOVEMESSAGE="YES/NO" ATTACHMENTDEST="text" SAVEMODE="text (options)" FROM="text" TO="text" SUBJECT="text" BODY="text" CC="text" HASATTACHMENT="text (options)" HASBEENREAD="text (options)" IFNEWERTHAN="text (date expression)" IFOLDERTHAN="text (date expression)" />
Description
Retrieves one or more messages from the specified server and populates a dataset with the results. This activity contains a filtering function that allows retrieval of specific messages based on the criteria specified.
Practical usage
Commonly used to retrieve multiple or all messages from the server.
Parameters
Connection
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Connection | --- | --- | --- | --- | Indicates
where user credentials, server settings, and other preferences
required to establish a connection to the email server
originate.
The available options are:
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes. |
Connection - Session
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Session | Text | Yes, if Connection is set to Session | EmailSession1 | SESSION="emailSess1" | The existing Email-based session to use with this activity. The default value is EmailSession1. This parameter becomes available and is required if the Connection parameter is set to Session. |
Connection - Host > Server
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Protocol | Text (options) | Yes | SMTP |
|
Specifies the protocol to use to connect to the email server. The available options are:
|
Refer to these parameters when Protocol is set to POP3 or IMAP. | |||||
Server | Text | Yes | (Empty) | SERVER="mail.server.com | Specifies the email server address to use with the connection. |
Port | Number | Yes | 25 | PORT="3333" | The
port to use to connect to the email server. The default port value varies for each protocol, but this parameter can be customized to connect to another port, if required. The default port numbers are:
|
Security | Text (options) | Yes | No security |
|
The
type of security to use with the connection to the email server. The available
options are:
|
Authentication Type | Text (options) | Yes | Auto |
|
Specifies
the authentication protocol to use. The following options are:
|
Username | Text | Yes | (Empty) | USERNAME="theuser" | The username to use to for authentication. |
Password | Text | Yes | (Empty) | PASSWORD="text (encrypted)" | The password that corresponds with the Username parameter to use for authentication. Manually enter a password, or click the ![]() |
Certificate | Text | No | (Empty) | CERTIFICATE="c:\folder\certname.pfx" | Specifies the path and file name of the certificate (.cer or .pfx extension) to use to authenticate. This parameter is only available if the Security parameter is set to Explicit TLS/SSL or Implicit TLS/SSL. |
Passphrase | Text | No | (Empty) | CERTIFICATEPASSPHRASE="text (encrypted)" | The
certificate passphrase to use to authenticate. Manually enter a passphrase, or click the ![]() |
Refer to these parameters when Protocol is set to WEBDAV (Exchange 2003, 2007). | |||||
Email address | Text | Yes | (Empty) | EMAILADDRESS="test@netauto.com" | A valid email address to use to authenticate the connection to the Exchange server. |
HTTPS/HTTP | Yes/No | Yes | HTTPS | USEHTTP="YES" | Indicates whether to use HTTP (normal HTTP) or HTTPS (secure HTTP) as the Exchange server protocol type. |
Exchange server | Text | Yes | (Empty) | SERVER="server.domain.com" | Specifies the address of the Exchange server. |
Authentication type | Text (options) | Yes | Basic |
|
Specifies the type of authentication to use to connect to the Exchange server. The available options are:
NOTE: If you are unsure
of the option to use for this parameter, contact your network administrator |
Domain name | Text | Yes | (Empty) |
|
The domain name (for example, domain.exchangeServer.com) or IP address to use to connect to the Exchange server. |
Username | Text | Yes | (Empty) | USERNAME="theUser" | A valid username to use to authenticate the connection to the Exchange server. This value may or may not be identical to the value set in the Email address field. |
Password | Text | Yes | (Empty) | PASSWORD="text (encrypted)" | A valid password, corresponding to the Username parameter, to use to authenticate Exchange
connection. This parameter is encrypted in Task Builder. Manually enter a password, or click the ![]() |
Refer to these parameters when Protocol is set to EWS (Exchange 2007 & newer, Online). | |||||
Email address | Text | Yes | (Empty) | EMAILADDRESS="test@netauto.com" | A valid email address to use to authenticate the connection to the Exchange server. |
Username | Text | Yes | (Empty) | USERNAME="theUser" | The username to use to authenticate the connection to the Exchange server. |
Password | Text | Yes | (Empty) | PASSWORD="text (encrypted)" | The password that corresponds with the Username parameter to use to authenticate Exchange
connection. This parameter is encrypted in Task Builder. Manually enter a password, or click the ![]() |
Domain name (optional) | Text | No | (Empty) |
|
The domain name (for example, domain.exchangeServer.com) or IP address to use to connect to the Exchange server. |
HTTPS/HTTP | Yes/No | Yes | HTTPS | USEHTTP="YES" | Indicates whether to use HTTP (normal HTTP) or HTTPS (secure HTTP) as the Exchange server protocol type. |
Exchange server | Text | Yes | (Empty) | SERVER="server.domain.com" | Specifies the address of the Exchange server. Click Discover to automatically discover the server based on the information entered in the Email address, User, and Password parameters. |
Authenticate as current windows user | Yes/No | No | Disabled | AUTHTYPE="default" | If selected, authentication to the Exchange server is by way of the current Windows user's credentials, and the Username, Password and Domain name parameters are disabled. This parameter is disabled by default. |
Rediscover server at runtime | Yes/No | No | No | AUTODISCOVERURL="YES" | If selected, the Autodiscover service automatically performs at runtime (disabled by default). The Autodiscover service makes it easier to configure Outlook 2007 or newer, as well as some mobile phones, by using a user's email address and password to automatically configure a user's profile. Setting this parameter to YES disables the Exchange server parameter. |
Refer to these parameters when Protocol is set to EWS Online. | |||||
Email address | Text | Yes | (Empty) | EMAILADDRESS="test@netauto.com" | A valid email address to use to authenticate the connection to the Exchange server. |
Tenant ID | Text | Yes | (Empty) | TENANTID="text (encrypted)" | The Directory (tenant) ID to use for authentication. This parameter is encrypted in Task Builder. |
Client ID | Text | Yes | (Empty) | CLIENTID="text (encrypted)" | The Application (client) ID to use for authentication. This parameter is encrypted in Task Builder. |
Client secret | Text | Yes | (Empty) | CLIENTSECRET="text (encrypted)" | The client secret Value to use for authentication. Manually enter a value, or click the ![]() Once the Email address, Tenant ID, Client ID, and Client secret parameters are populated, click Verify to perform a test connection to the Exchange Online server. |
Connection - Host > Advanced
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Current folder | Text | Yes | Calendar | CURRENTFOLDER="Contact" | The Exchange folder of where to perform this activity. This parameter is disabled if the Protocol parameter is set to POP3. |
Timeout (seconds) | Number | Yes | 100 | TIMEOUT="120" | The total amount of time in seconds that this activity is allowed to execute before a time out error occurs. |
TLS cipher(s) | Text (options) | Yes, if Protocol is set to SMTP, POP3, or IMAP and Security is set to Explicit TLS/SSL or Implicit TLS/SSL | All |
|
Specifies the TLS/SSL cipher to use. This parameter is only available and required if the Protocol parameter is set to POP3 or IMAP and the Security parameter to Explicit TLS/SSL or Implicit TLS/SSL. The following cipher options are:
|
TLS option(s) | Text (options) | Yes, if Protocol is set to SMTP, POP3, or IMAP and Security is set to Explicit TLS/SSL or Implicit TLS/SSL | Any |
|
Specifies the TLS/SSL versions allowed. This parameter is only available and required if the Protocol parameter is set to POP3 or IMAP and the Security parameter to Explicit TLS/SSL or Implicit TLS/SSL. The available options are:
|
Impersonate | Yes/No | No | No | IMPERSONATE="YES" | If
selected, this parameter allows an
account on an Exchange server to perform actions by using the
permissions that are associated with another account, instead
of the permissions that are associated with the caller's account.
This parameter is disabled by default. This parameter is only available if the Protocol
parameter is set to EWS (Exchange
2007 & newer, Online). NOTE: With Exchange
Impersonation, one account is acting as another account. When
an account is impersonated, the system logs the access as if the
account that is specified in the header were acting on the system.
The calling account must have the appropriate permissions to perform
impersonation. |
Ignore invalid server certificate | Yes/No | No | No | IGNOREINVALIDCERTIFICATE="YES" | If selected, invalid or expired SSL server certificates are ignored. If disabled (default) and an invalid server certificate is found, this step throws an error stating that the security certificate on the server is not valid. This parameter is only available if the Protocol parameter is set to EWS (Exchange 2007 & newer, Online). |
Proxy type | Text (options) | No | System default |
|
Specifies the proxy type for Automate to use
when attempting network communications through a proxy server. The available options are:
NOTE:
|
Proxy server | Text | Yes, if Proxy type is set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP | (Empty) |
|
The hostname (server.domain.com) or IP address of the proxy server. This parameter is only available and required if the Proxy type parameter is set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP. |
Proxy port | Number | Yes, if Proxy type set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP | 1028 | PROXYPORT="3000" | The proxy port number to use to connect to the proxy server. Most proxy servers operate on port 1028 ( default), however, a proxy server can operate on other ports. This parameter is only available and required if the Proxy type parameter is set to SOCKS 4, SOCKS 4A, SOCKS 5, or HTTP. |
Proxy username (optional) | Text | No | (Empty) | PROXYUSERNAME="username" | The username to use to authenticate when connecting through the proxy server. This parameter is only available if Proxy type is set to SOCKS 5 or HTTP. |
Proxy password (optional) | Text | No | (Empty) | PROXYPASSWORD="text (encrypted)" | The password corresponding with the Proxy username parameter to use to authenticate
when connecting through the proxy server. This parameter is encrypted in Task Builder. Manually enter a password, or click the ![]() |
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Create and populate dataset | Text | Yes | (Empty) | RESULTDATASET="mydataset" | The name of the dataset to create and populate with the results of this activity. |
Remove mail from server | Yes/No | No | No | REMOVEMESSAGE="yes" | If selected, specifies that mail is permanently removed from the server. This parameter is disabled by default. |
Save attachment(s) in folder | Text | No | (Empty) | ATTACHMENTDEST="c:\temp" | If enabled, specifies the folder of where to save attachments. Click the folder icon to navigate to the desired save location where or manually enter the location in the provided text box. |
If filename already exists | Text (options) | No | Do not save |
|
Determines the action to perform if an attachment
with the same name already exists in the destination folder. Determines the action to perform if an attachment
with the same name already exists in the destination folder. This parameter is disabled if the Save attachment(s) in folder parameter is cleared. The available options are:
|
Filter
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
From | Text | No | (Empty) | FROM="me" | Applies a filter to only retrieve messages containing the same "From" email address as specified in this parameter. |
To | Text | No | (Empty) | TO="you" | Applies a filter to only retrieve messages containing the same "To" email address as specified in this parameter. |
Subject | Text | No | (Empty) | SUBJECT="Hello" | Applies a filter to only retrieve messages containing the same words in the "Subject" field as specified in this parameter. |
Body | Text | No | (Empty) | BODY="text2" | Applies a filter to only retrieve messages containing the same words in the body of the message as specified in this parameter. |
CC | Text | No | (Empty) | CC="text3" | Applies a filter to only retrieve messages containing the same "Cc" email address as specified in this parameter. |
Has attachments | Text (options) | No | No |
|
Determines how messages with attachments are filtered. The available options are:
|
Has been read | Text (options) | No | No |
|
Determines how messages that have been read are filtered. This parameter is disabled if the Protocol parameter is set to POP3. The available options are:
|
Only if newer than | Date | No | (Empty) | IFNEWERTHAN="%DateSerial(2010,12,22)+TimeSerial(14,21,03)%" | If selected, a filter is applied to only retrieve messages newer than the date/time specified. Click Custom to select from a list of custom date/time intervals. Select Expression to enter a specific date/time expression. This parameter is cleared by default. |
Only if older than | Date | No | (Empty) | IFOLDERTHAN="%DateSerial(2010,12,22)+TimeSerial(14,21,03)%" | If selected, a filter is applied to only retrieve messages older than the date/time specified. Click Custom to select from a list of custom date/time intervals. Select Expression to enter a specific date/time expression. This parameter is cleared by default. |
Additional notes
Well-known mailbox folders
Each user's mailbox folder has a set of properties that you can use to retrieve well-known folders, such as Inbox, Calendar, Drafts, and Tasks. Specifying a subfolder requires first specifying the name of the folder from the well-known folders level as the parent folder, followed by a / character as the delimiter, and then the subfolder name (for example, Inbox/SubFolderName). To specify a folder that you created in the well-known folders level, you must specify the root of the message folder hierarchy (for example, MsgFolderRoot/SubFolderName). The table below defines common folder names (in alphabetical order) that are used in users mailboxes.
Name | Description |
---|---|
ArchiveDeletedItems | The Deleted Items folder in the archive mailbox. |
ArchiveMsgFolderRoot | The root of the message folder hierarchy in the archive mailbox. |
ArchiveRecoverableItemsDeletions | The root of the folder hierarchy of recoverable items that have been soft-deleted from the Deleted Items folder of the archive mailbox. |
ArchiveRecoverableItemsPurges | The root of the hierarchy of recoverable items that have been hard-deleted from the Deleted Items folder of the archive mailbox. |
ArchiveRecoverableItemsRoot | The root of the Recoverable Items folder hierarchy in the archive mailbox. |
ArchiveRecoverableItemsVersions | The root of the Recoverable Items versions folder hierarchy in the archive mailbox. |
ArchiveRoot | The root of the folder hierarchy in the archive mailbox. |
Calendar | The Calendar folder. |
Contacts | The Contacts folder. |
DeletedItems | The Deleted Items folder. |
Drafts | The Drafts folder. |
Inbox | The Inbox folder. |
Journal | The Journal folder. |
JunkEmail | The Junk email folder. |
MsgFolderRoot | The root of the message folder hierarchy. |
Notes | The Notes folder. |
Outbox | The Outbox folder. |
PublicFoldersRoot | The root of the Public Folders hierarchy. |
RecoverableItemsDeletions | The root of the folder hierarchy of recoverable items that have been soft-deleted from the Deleted Items folder. |
RecoverableItemsPurges | The root of the folder hierarchy of recoverable items that have been hard-deleted from the Deleted Items folder. |
RecoverableItemsRoot | The root of the Recoverable Items folder hierarchy. |
RecoverableItemsVersions | The root of the Recoverable Items versions folder hierarchy in the archive mailbox. |
Root | The root of the mailbox. |
SearchFolders | The Search Folders folder, also known as the Finder folder. |
SentItems | The Sent Items folder. |
Tasks | The Tasks folder. |
Voicemail | The Voicemail folder. |
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
This sample task retrieves all messages from a POP3 email server, creates and populates a dataset with the results, and saves all attachments in a specified folder.
<AMEMAIL ACTIVITY="all_messages" SERVER="mail.server.com" USERNAME="username" PASSWORD="AM54OLPWf5KfjEl9wTvTuDFSl57ufF43L4Tcjd/5xKrqIo=aME" TIMEOUT="30" SECURITY="explicit" TLSCIPHERS="All" TLSVERSIONS="Any" RESULTDATASET="theDataset" ATTACHMENTDEST="c:\temp" FROM="Admin" />