UiPath Get Outlook Mail Messages Body Example |Video upload date:  · Duration: PT6M0S  · Language: EN

Learn how to extract email body text with the UiPath Get Outlook Mail Messages activity and feed that content into an automation workflow.

If your workflow needs to read email content and you do not want to hand the job to a human, welcome to the gloriously boring world of email parsing with UiPath. This quick tutorial covers the Get Outlook Mail Messages activity in UiPath Studio and shows how to pull the Body from MailMessage objects so your automation can do the heavy lifting and your team can pretend they are busy.

What this tutorial covers

  • Place and configure the Get Outlook Mail Messages activity
  • Filter messages and limit results with Top and OnlyUnread
  • Access the Body property in a For Each loop and store it for parsing
  • Handle HTML messages and encoding quirks
  • Catch errors and mark or move processed mail

Step 1 Place the Get Outlook Mail Messages activity

Drag Get Outlook Mail Messages into a sequence or flow. If you have multiple Outlook profiles set the Account property to the mailbox you want. If you do not set an account UiPath will use the default Outlook profile and that usually works unless your IT enjoys chaos.

Step 2 Configure basic filters and folder

Set MailFolder to Inbox or a specific subfolder to limit the search. Use Top to cap how many messages you fetch per run. If you only want new emails set OnlyUnread to true. These filters keep your automation from trying to process the entire internet.

Step 3 Read the Body from each MailMessage

Use a For Each activity typed to System.Net.Mail.MailMessage or UiPath mail types depending on your packages. Inside the loop grab the body with mail.Body and save it to a string variable for parsing or storage. Treat the string like fragile glass and parse gently.

Plain text versus HTML

If the message is plain text you can parse right away. If it is HTML do not try to strip tags with fragile regex magic unless you enjoy debugging for fun. Use a proper HTML parser or a cleaning step to remove tags and decode entities.

Step 4 Parsing and storage tips

  • Save the raw Body to a file or table first. That makes debugging less painful when parsing fails.
  • Isolate the cleaning step into its own workflow. That allows safe improvements without re fetching emails.
  • Watch for encoding quirks and unusual line endings when reading bodies from different mail clients.

Step 5 Handle errors and mark processed messages

Wrap the mail fetch and processing in Try Catch to handle network issues and permissions gracefully. When a message is processed use MarkAsRead or Move to an archive folder so you do not process the same item twice. You can also add logging so audits do not become urban myths.

Common gotchas and pro tips

  • If HTML contains inline images or complex formatting save the raw body first and then run a separate parse job.
  • When filtering by folder remember subfolders are not included unless you target them explicitly.
  • Limit Top on first runs to avoid overloading downstream systems.
  • Test with sample messages that include attachments encoded text and different charsets to reduce surprise failures.

That is the gist of reading email bodies with UiPath and Outlook. You get Mail messages, pull the Body, clean it if needed and mark messages so your bot does not become an overeager retriever of duplicates. Happy automating and try not to let the inbox win.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.