The OPEN command will login into the IMAP server and read any email messages stored for that user.
If the server, user, and password are not defined in the service's properties file, they must be provided in the OPEN command.
Internally, a folder object is created to hold these messages. The GET and DELETE commands work against this internal folder object.
Syntax:
Command | Keyword | Value | Developer notes |
|---|---|---|---|
OPEN | SERVER | host | The server address for the IMAP server. The SERVER property is typically included in the POP3MailService properties file, but if not, it must be provided here. |
TENANT.ID | Value | The unique identifier of the Azure AD tenant. Required when using XOAUTH2 with Microsoft identity platform. Ex: abcd1234-5678-90ef-ghij-klmnopqrstuv | |
CLIENT.ID | Value | The client_id is a public identifier for apps. Even though it’s public, it’s best that it isn’t guessable by third parties, so many implementations use something like a 32-character hex string. Ex- Foursquare: ZYDPLLBWSK3MVQJSIYHB1OR2JXCY0X2C5UJ2QAR2MAAIT5Q | |
CLIENT.SECRET | Value | The client_secret is a secret known only to the application and the authorization server. It is essential the application’s own password. It must be sufficiently random to not be guessable, which means you should avoid using common UUID libraries, which often take into account the timestamp or MAC address of the server generating it. Ex - A great way to generate a secure secret is to use a cryptographically-secure library to generate a 256-bit value and then convert it to a hexadecimal representation. bin2hex(random_bytes(32)); Lq08Q~EtgN-BpoINX6msRD9GL_cCx | |
AUTH.TOKEN.ENDPOINT | Value | Token endpoint is used by the application in order to get an access token or a refresh token. It is used by all flows except for the Implicit Flow because, in that case, an access token is issued directly. Ex -https://login.microsoftonline.com/5c951c05-0f75-44ef-6223f150a449/oauth2/v2.0/token | |
AUTH.SCOPE | Value | Scope is a way to limit an app’s access to a user’s data. Rather than granting complete access to a user’s account, it is often useful to give apps a way to request a more limited scope of what they are allowed to do on behalf of a user. Ex- https://outlook.office365.com/.default | |
TOKEN.CACHE | Value | This is a boolean parameter to save the token at the mentioned directory. It can have two values- true or false. Ex - Token.cache = true In this case generated token will be saved at the path mentioned in Token.cache.dir parameter. | |
TOKEN.CACHE.DIR | Value | It is a directory where the user wants to save the token while caching. Ex- C:\Program Files (x86)\LANSA\dummy | |
SESSION.DEBUG | Value | Enable session debugging to display debugging messages in the user interface. Ex- true or false | |
PORT | integer | IMAP server port. Default is 143. | |
SECURE | *NO | Default. No secure connection. | |
*YES | Use implicit connection. | ||
*IMPLICIT | Connects to port 993 using SSL. | ||
*EXPLICIT | Connects to port 143 and upgrades to a TLS session. | ||
USER | value | The IMAPmail user's login identification. It is usually supplied in the IMAPMailService properties file but if not, it must be provided here. | |
PASSWORD | value | The password corresponding to the IMAP User provided as the USER keyword. It is usually supplied in the IMAPMailService properties file but if not, it must be provided here. | |
AUTH | *XOAUTH2 | Token based authentication. | |
*PASSWORD | Default. User and password authentication. | ||
KEYSTORE | name:password | Read the keystore file. The keystore value is in the format of name:password. The keystore file to be read is obtained from the property keystore.{name}. The keystore password is the password component. | |
TIMEOUT.READ | Value | The read timeout is the timeout on waiting to read data. If the server (or network) fails to deliver any data <timeout> seconds after the client makes a socket read call, a read timeout error will be raised. Default value timeout.read = 90000 | |
TIMEOUT.WRITE | Value | A write timeout defines a maximum time of inactivity between two data packets when sending the request to the server. Default value timeout.write = 90000 | |
TIMEOUT.CONNECTION | Value | A connect timeout defines a time period in which the client should establish a connection with a target host. Default value timeout.connection = 90000 | |
RECIPIENT | name:password | This keyword is required to decrypt secure messages that have been encrypted with the recipient's public key. The recipient value is comprised of two parts, the name and password, in the format name:password. These values are used to access the private key and certificate in the keystore. Refer to the KEYSTORE keyword. The private key and certificate are stored in a keystore file using a label. The label is the name component, and the password component is used to read the private key. |
Example
OPEN USER(user) PASSWORD(password)