Hi,
i’m working on project that get outlook mail message every day and download the files to folder.
the robot is gets a trigger by time, search for the mail by subject( contains the current date) and if it finds it, it download the files and send a mail that says the files were download and if it finds a mail, but it does not contains a file, it send a mail that says it could not find the files.
i created a scenario that there are two exact mails - one of them contains a file and the other is not
the problem is, the robot get the two mails and sends two mails. one says that the files were downloaded and the other one says that the file were not found.
how can I make it to send only the mail that the files were downloaded even if there is another mail without any files in it?
As per the logic you are trying to send 2 emails, Files were downloaded and File were not found.
Also you have mentioned you created 2 emails, one with atatchment and another without attachment. So i think the mails triggered as per the logic.
If you want to check the files with attachment and without atatchment you can write as below.
Item.Attachments.Any
Just simply use an if statement. If the file has an attachment, as per your logic, send the email. If the mail does not have and attachment AND the email with the attachment is also present, dont send an email. I have a similar instance where the business team send an email very similar to your logic and this works for me.