Exchange Mail Reader

Read Exchange Online emails via IMAP. An account that supports Exchange Online is required

TENANT ID (supports %FILENAME% variables)

Azure Active Directory tenant ID created in Azure Portal:

CLIENT ID (supports %FILENAME% variables)

The unique Application (client) ID is assigned to your app by Microsoft Entra ID when the app is registered. Here's how to register a client ID:

The account type should remain the default Single tenant, the platform setting should be Web, and the URI should be set to http://localhost:3650/callback.

After completing the registration, you can obtain a client ID and then proceed to Add a certificate or secret:

After completing adding the New client secret, copy the value of the client secret:

CLIENT SECRET (supports %FILENAME% variables)

Fill in the client secret mentioned above.

SIGN IN

After pressing the SIGN IN button, Microsoft Account verification will be performed. After successful verification, the user's email account will be automatically filled in, and EMILY.RPA can use this email mailbox. Please note: Microsoft will force the login information to expire 90 days after SIGNing IN, so you need to return to the module interface to log in again every 90 days. Learn more: https://learn.microsoft.com/en-us/azure/active-directory/develop/configurable-token-lifetimes#refresh-and-session-token-lifetime-policy-properties

ACCOUNT

After filling in the TENANT ID, CLIENT ID, and CLIENT SECRET, clicking SIGN IN will open a browser to allow the user to complete the authentication process and automatically fill in the ACCOUNT field.

MAILBOX

Mailbox name.

SINCE DAY(S) AGO

Read emails since how many days ago.

UNREAD ONLY

Choose whether to read unread emails only.

Input Object

Each element in the input object array represents each email read from the specified mailbox:

// Print the subject and sender of each email read
input.forEach((mail) => {
  console.log('from:' + mail.from + ', title:' + mail.subject)
})

Output Object

Each object added to the output array represents a row of data in the output table. The object contains key-value pairs, where the key is the column header, and the value is the data for that column in the row. Once all the data is processed, the table will be output as a .csv file called 'output.csv' in the workspace.

// Output each text field from the read emails to a CSV and save attachment files.
input.forEach((mail) => {
  output.push({
    from: mail.from,
    subject: mail.subject,
    date: mail.date.toLocaleString(),
  })
  
  if (mail.attachments.length > 0) {
    mail.attachments.forEach((att) => {
      api.write(att.filename, att.content)
    })
  }
})

// Specify the header field
output.header.push('from','subject','date')

--

We are dedicated to improving our content. Please let us know if you come across any errors, including spelling, grammar, or other mistakes, as your feedback is valuable to us! 🤖️⚡️

Last updated