How to read mails from Gmail using app password UiPath
When we are automating a business process, there will be a scenario where you need to work with Gmail and read emails from Gmail.
In this article, let’s see how we can achieve this task of how to read mails from Gmail using UiPath.
Let’s get into the practical implementation of this task now:
Step1: Drag and Drop the Get IMAP Mail Messages activity from the activities panel to the designer panel as shown below:
The required properties for this activity are shown below:
Here:
- MailFolder – Provide the mail folder name from where it needs to read the emails.
- Port – Provide the port number (in this scenario it is 993)
- Server – Provide the server name to which it needs to connect(in this scenario it is imap.gamil.com)
- Email – Provide the email address from where emails need to be read.
- Password – Provide the password for the email address that is given above.
- MarkAsRead – Check this option if you want the email to be marked as read once it reads an unread email.
- OnlyUnreadMessages – Check this option if you want to read only unread emails from the specified email folder.
- OrderByDate – This option order mail messages by date.
- Top – The number of messages to be retrieved, starting from either the newest or the oldest.
- Messages – The retrieved messages as a collection of mail message objects.
We need to provide the credentials as shown in the image above.
But lately, google has depreciated using the ‘Allow less secure apps’ option.
Because of this, it is throwing Invalid credentials error.
In order to resolve this error instead of using a general mail password, we need to use an app password.
How can we create an app password for gamil?
Step1: Open your Gmail and click on manage your google account.
Step2: Go to the security tab as shown below:
Step3: Complete the 2-Step verification, once you complete that then the app passwords will show up just below that as shown below:
Step4: Click on the App passwords section and it will take you to a page where you can create a new app password as shown below:
Step5: Now select the app as mail and device as windows computer as shown below:
Step6: The final step is to click on generate. It will create a new app password as shown below:
Note this down carefully and you can use this instead of your normal mail password to read mails from Gmail using UiPath or to send mails from Gmail using UiPath.
To know how to create that follow the below-linked URL:
https://support.google.com/mail/answer/185833?hl=en
Thanks so much, I’ve been looking for this for hours!
Glad it helped!