Need help in automating a process using Email - POP3/SMTP.

#1
Hi All,

Need help in automating a process using Email - POP3/SMTP.
Requirement is an email with specific "Subject" and "attachment" is checked (Email is checked 24/7).If both condition is matched. It downloads the attachment to specific folder.
Can we achieve this is Blue Prism.Require your help.

Thanks in advance
 

VJR

Well-Known Member
Staff member
#4
Hi rsingh40,

For information are you using Outlook or any other email client?
Using 'Email - POP3/SMTP' object in Blue Prism you can read an email, its subject and save its attachment to a folder.
But I haven't seen any option it provides to read only Unread emails or any new email as it arrives, else BP will again and again read the same emails each time. This can be avoided by having BP store all the message Ids of previous run and then on every new run check if the new Message Id is the same as the one on the already stored ones. This is not a good approach if there are lots of emails. I haven't got Outlook on the machine with Blue Prism so I cannot tell you more. See if you are able to achieve it by making use of this link which shows how to get the messages and save their attachments -> Blue Prism Email Attachments, Get Emails and Save Attachments.
If it doesn't have that feature then you may try by making code modifications to the 'POP3/SMTP' object to get only unread emails.

If you are using Outlook I can suggest you another approach but it is outside of Blue Prism and requires a change on every machine that uses Outlook.
 

VJR

Well-Known Member
Staff member
#6
Hi rsingh40,

- In the below link refer section that says "VBA: Auto Save Outlook Attachments into a certain folder"
https://www.extendoffice.com/docume...o-download-save-attachments-to-folder.html#a1
- Paste that code into Outlook's VBA editor. Instructions are given on the link.
- Set the rule to run only when any message arrives as explained.
You need to add a additional Rule "with specific words in the Subject".
- Select the script that has the new function added
The macro script will run only on new messages that arrive and save its attachment to the specified folder.

Note: If you may have attachments with same name then you may end up downloading and overwriting the attachments in the folder. So suffix a date and time stamp using the below change of code to avoid overwriting.

Change From:
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName

Change To:
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName & "_" & Format(Now, "dd-mm-yy hh_mm_ss")
 
#8
Hi rsingh40,

For information are you using Outlook or any other email client?
Using 'Email - POP3/SMTP' object in Blue Prism you can read an email, its subject and save its attachment to a folder.
But I haven't seen any option it provides to read only Unread emails or any new email as it arrives, else BP will again and again read the same emails each time. This can be avoided by having BP store all the message Ids of previous run and then on every new run check if the new Message Id is the same as the one on the already stored ones. This is not a good approach if there are lots of emails. I haven't got Outlook on the machine with Blue Prism so I cannot tell you more. See if you are able to achieve it by making use of this link which shows how to get the messages and save their attachments -> Blue Prism Email Attachments, Get Emails and Save Attachments.
If it doesn't have that feature then you may try by making code modifications to the 'POP3/SMTP' object to get only unread emails.

If you are using Outlook I can suggest you another approach but it is outside of Blue Prism and requires a change on every machine that uses Outlook.
1. Read the email using Get Mail 2. check to confirm that email was retrieved 3. check the Subject 4. If Subject matches move file to specific folder 5. If Subject does not match move email to different folder
U
 
#10
Hi VJ,

Need help in automating a process using Email - POP3/SMTP.
Requirement is an email with specific "Subject" and "attachment" is checked If both condition is matched. It downloads the attachment to specific folder.
Can we achieve this is Blue Prism using Mapiex?

Thanks in advance
Dheeraj
 
#13
@Sukesh , @ Varun
1. Read the email using Get Mail 2. check to confirm that email was retrieved 3. check the Subject 4. If Subject matches move file to specific folder 5. If Subject does not match move email to different folder.

I am able to do with above logic . But one concern is that I don't to move the email whose subject does not match to different folder, if I don't move to different folder then with Mapiex every time it read the same the email which is on top . I want to read all mails one by one and want to move matching subject email in subfolder.
 
#14
Yes dheeraj Kumar you can achieve this using Mapiex VBO.........
@Sukesh
1. Read the email using Get Mail 2. check to confirm that email was retrieved 3. check the Subject 4. If Subject matches move file to specific folder 5. If Subject does not match move email to different folder.

I am able to do with above logic . But one concern is that I don't to move the email whose subject does not match to different folder, if I don't move to different folder then with Mapiex every time it read the same the email which is on top . I want to read all mails one by one and want to move matching subject email in subfolder.
 
#15
You can do this using mapiex vbo but the Outlook in ur system should be configured prior.
, @ Varun

1. Read the email using Get Mail 2. check to confirm that email was retrieved 3. check the Subject 4. If Subject matches move file to specific folder 5. If Subject does not match move email to different folder.

I am able to do with above logic . But one concern is that I don't to move the email whose subject does not match to different folder, if I don't move to different folder then with Mapiex every time it read the same the email which is on top . I want to read all mails one by one and want to move matching subject email in subfolder.
 
#16
@Sukesh
1. Read the email using Get Mail 2. check to confirm that email was retrieved 3. check the Subject 4. If Subject matches move file to specific folder 5. If Subject does not match move email to different folder.

I am able to do with above logic . But one concern is that I don't to move the email whose subject does not match to different folder, if I don't move to different folder then with Mapiex every time it read the same the email which is on top . I want to read all mails one by one and want to move matching subject email in subfolder.
Just make sure to check the unread only flag type value "True" it will check only unread and "False" it will check all mails.
 
#17
yes it will
Just make sure to check the unread only flag type value "True" it will check only unread and "False" it will check all mails.
Thanks Sukesh, It will be check only unread email , but unread email can have different subject , without moving to other folder it will read the same email again and again ..
 
#18
Hi,
Can someone pls let me know how to do the below requirement.
I have a folder called "Opened" just lying parallel to Inbox. Remember it is not the subfolder of Inbox. Just lying parallel to inbox.
I also have another sub folder called "Success" within "Opened" folder. Now my requirement is to move mail from inbox to "Success" folder.
 
#19
, @ Varun

1. Read the email using Get Mail 2. check to confirm that email was retrieved 3. check the Subject 4. If Subject matches move file to specific folder 5. If Subject does not match move email to different folder.

I am able to do with above logic . But one concern is that I don't to move the email whose subject does not match to different folder, if I don't move to different folder then with Mapiex every time it read the same the email which is on top . I want to read all mails one by one and want to move matching subject email in subfolder.
@Varun/Dheera: Can you tell me how did you achieved move mail to specific folder
 
#20
Hi VJR, Can you please help on below two queries:
1. how to read the mail which is already opened.
2. how to read the mail which is stored in any folder in desktop.

Thanks
 
Top