Send Email Attachments from Gmail with UiPath Tutorial |Video upload date:  · Duration: PT5M1S  · Language: EN

Quick guide to sending Gmail attachments with UiPath covering authentication packages activities and error handling for reliable automation

Quick summary for the impatient human

If you want UiPath to send email attachments from Gmail without throwing tantrums or random authentication errors this guide will get you there. We keep security intact and use official mail activities so your automation behaves like a responsible adult.

What you need before you start

  • UiPath Studio installed and a project ready to be dramatic
  • A Gmail account with either OAuth credentials or an App Password if you have two factor authentication
  • The UiPath mail activities or the GSuite package from Manage Packages in Studio
  • Files to attach with absolute file paths and a healthy respect for File.Exists checks

Prepare Gmail authentication the less painful way

Do not use less secure app access unless you like frustration. Create OAuth credentials for production level flows or generate an App Password for personal accounts that use two factor authentication. The GSuite package can handle OAuth scopes for you which is convenient and less likely to break next week.

Notes on authentication

App Passwords work fine for SMTP when you cannot or do not want to implement OAuth. For enterprise grade automation set up OAuth and store tokens securely in Orchestrator assets or a vault.

Install the right UiPath package

Open Manage Packages and install either UiPath.Mail.Activities or UiPath.GSuite depending on your chosen path. The mail package gives you Send SMTP Mail Message and handy helpers for attachments. The GSuite package gives OAuth integration and Gmail specific activities if you prefer API level control.

Build a reliable attachment list

Do not guess where files live. Use absolute paths and construct a List(of String) for multiple attachments. Before you try to attach anything verify the file exists. This saves a whole lot of debugging and shame.

Checklist for attachments

  • Use absolute paths like C:\Data\Reports\report.pdf
  • Confirm File.Exists before adding to the list
  • Handle missing files with a log entry and a graceful fallback

Configure Send SMTP Mail Message properly

Use smtp.gmail.com as the host and 587 as the port. Enable SSL when using SMTP. Supply credentials via an Orchestrator asset or use the OAuth tokens from the GSuite package. Fill the To Subject Body and Attachments fields with workflow variables so your process is not hard coded to yesterday's email list.

Important settings

  • Host smtp.gmail.com
  • Port 587 with SSL enabled for STARTTLS
  • Credentials from secure assets or OAuth tokens
  • Attachments as a List(of String) variable

Test and add error handling like a grown up

Run the workflow in Debug and watch the Output panel. Wrap mail sending in a Try Catch and catch authentication exceptions missing file exceptions and network failures. Log clear messages so the next human or robot knows what went wrong without guessing.

Suggested Try Catch approach

  • Try to send the message
  • Catch authentication failures and log instructions to check OAuth or App Passwords
  • Catch file related exceptions and log the missing path
  • Catch general exceptions and include the StackTrace in debug logs only

Final checklist for reliable automation

  • Gmail authentication is configured securely
  • Mail activities or GSuite package is installed in UiPath Studio
  • Attachment list uses absolute paths and checks existance
  • Send SMTP Mail Message is configured with smtp.gmail.com port 587 and SSL
  • Error handling and logging are in place for easy recovery

Follow these steps and your automation will send Gmail attachments like a responsible intern who actually reads instructions. If something still misbehaves check credentials network connectivity and file paths in that precise order.

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.