What is the order of download of the Download Email Attachments activity for inline attachments?

To give the inline images an auto-generated index name when downloading them, follow these steps in UiPath:

  1. Get Mail Messages: Use the Get Mail Messages activity to fetch the emails with inline images.
  2. For Each Loop: Use a For Each loop to go through the attachments of each email.
  3. Check for Inline Images: In the loop, check if the attachment is an inline image (using Content-Disposition).
  4. Download and Rename with Auto Index: Download each inline image and save it with an auto-incremented index as the filename.

Here’s how you can implement this in UiPath:

Steps:

  1. Get Mail Messages:
    Set up the Get Mail Messages activity to fetch emails from your inbox.

  2. For Each Activity:
    Loop through each email’s attachments using a For Each activity.

  3. Check Inline Attachments:
    Use an If activity to check if attachment.ContentDisposition.Contains("inline").

  4. Download Inline Images with Index:
    Inside the If activity, use Download Email Attachments to download the attachment. To rename it with an index, create a variable (e.g., fileIndex), and increment it each time an inline image is processed.

Example:

fileIndex = 1  ' Initialize the index variable

For Each email In mailMessages  ' Loop through emails
    For Each attachment In email.Attachments  ' Loop through attachments
        If attachment.ContentDisposition.Contains("inline") Then  ' Check for inline image
            ' Build the file path with an index
            filePath = "C:\Your\Download\Path\image_" & fileIndex.ToString() & ".png"
            
            ' Download the inline image with the auto-generated name
            Download Email Attachments: attachment -> filePath
            
            ' Increment the index
            fileIndex = fileIndex + 1
        End If
    Next
Next

Key Points:

  • fileIndex starts at 1 and increments by 1 for each inline image, giving each image a unique name like image_1.png, image_2.png, etc.
  • You can adjust the file extension (.png) based on the actual type of image you’re downloading.
  • This process will automatically download all inline images from the emails and assign them sequential names.

This approach is simple and helps you organize inline images with auto-generated names.