Few dificulties faced sending email using UiPath


Hello everyone,

I am implementing a use case to process some data based on an excel. Read the data from excel. Process the data and write back to excel. Save and close excel. Now send email with attachment of the same excel. Delete the excel.

The issues are:
1.> When I am using “Send SMTP Email” activity, there is no authentication user and password setup for my SMTP server which is maintained by a big corporate thus changing the configuration is no-no. Also I can not use gmail as this is also unwanted for enterprise level development.

My question is why this activity has kept authentication user and password as mandatory field when it is optional for actual SMTP protocol?

2.> As an alternate solution based on UiPath Forum, I tried to use “Invoke Code” activity and wrote some VB.net code to send email using SMTP which is working fine.
But the issue is when I try to delete the excel after sending the email, it gives an error “The process cannot access the file because it is being used by another process”. Again looking into the forum, I have found that I have to use “Invoke Method” activity on System.GC.Collect and System.GC.WaitForPendingFinalizers methods. After using them, the error disappears and the file was deleted successfully.

Could you please explain why I do I have to use those GC methods? I am novice for MS technologies.

3.> Though it is not be possible to use “Send Outlook Email” activity as alternative for my project, but I tried to see how does it work. When I try “Send Outlook Email” activity, it works fine without the GC methods. Can anyone explain why the I am not to require the GC methods before deleting the file when using Outlook Send Email activity?



Give some time after sending email to delete the file


I have tried to put 10 sec delay but still the same issue. The issue is something else. The file is getting locked and until GC methods clear the garbage.