Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


chris.hill@adsigroup.co.uk
2019-11-29T14:34:20Z
I need to go through emails in an Exchange mailbox (connectivity I am happy with) and extract the body text, and also save attachments if there are any.
I need to read the content of the body text, and then break it into pieces - which I can do with some .Net code - however is there a task type that allows me to read the email body without first saving the email as a file? Ideally I want to loop through each email, read the text, into Std Output for example, and pass that to another task for the actual chopping up - I can only see options to save the email as a file currently?
Sponsor
Forum information
thomas
2019-11-29T15:38:56Z
Are you using mail triggers? If that's the case, you can get the body data from the trigger variable directly. No need to save anything

Capture.PNG
chris.hill@adsigroup.co.uk
2019-11-29T15:46:20Z
I have tried to add a mail trigger but can't seem to understand how to use it properly!

Where do I tell it to return the body of the email?

What context do I use it in - read one email at a time and return that to another task for processing / saving the attachments etc?

How did you get to that screen grab you attached?

I think I need to understand the basic principles / workflow I should be trying to achieve?

Thank you.
thomas
2019-12-02T10:01:44Z
Before I go into the details: do you need to performa this action on old emails, or only for new emails going forward? Triggers are mainly for the latter. If you need to extract the message bodies on a huge amount of existing emails, triggers are probably not the best solution
chris.hill@adsigroup.co.uk
2019-12-02T13:05:31Z
Going forward it would only be for new emails hitting a mailbox.
thomas
2019-12-02T13:40:39Z
Ok. The steps would be roughly like shown below. When setting up, chose a restrictive filter for testing. I will send mails from my gmail account as a test until I am happy with the result. It is also useful to set polling to 5-10 seconds when you are testing to avoid having to wait a lot. Once you are happy with the result, change the filter, and set the polling to something less frequent, eg 60 seconds.

1) Create a job.
2) In the triggers tab, add an event trigger of type email. In the Conditions section, add the appropriate filters. For example: 'From address' contains @gmail.com. In the Actions tab, choose something like in the image. Note that you may not want to delete on Server! In the Save mail tab, chose to not save mails/attachments

Capture.PNG
Capture.PNG

We now have a job without any tasks, just a trigger
3) Send a testmail that passes the filter you have set. You will see that the 'Last run' columns changes if the trigger is activated.
4) Open the variables window. Find your job, choose triggers, Mail. You will find variables there with info from the last trigger.

Capture.PNG

5) Add a task that uses the email content. Pass to a .net method or whatever you want to.

chris.hill@adsigroup.co.uk
2019-12-02T15:18:22Z
Many Thanks for your help with this - would this technique still work if there were say 20 emails delivered in a couple of minutes? i.e. does it just grab the first off the top of the pile each time it polls - it will only be for new emails, but they can arrive in batches - it's essentially notifications being sent to use from a CCTV camera system which sends notifications when someone triggers some movement - as they walk through the building there can be multiple sent quite quickly.

Thanks

Edit - I can see the Put Job in queue option seems to do that - it certainly seems to be running through and reading the emails - we will start it with a freshly emptied mail box.
thomas
2019-12-02T15:52:48Z
Hi

If you multiple emails arrive at the same time, it will trigger once for each mail. So it essentially is a forEach mail loop.
Scroll to Top