Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline chris.hill@adsigroup.co.uk  
#1 Posted : Friday, November 29, 2019 3:34:20 PM(UTC)
chris.hill@adsigroup.co.uk

Rank: Paid support

Joined: 3/28/2018(UTC)
Posts: 21

Thanks: 6 times
Was thanked: 1 time(s) in 1 post(s)
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?

Edited by user Friday, November 29, 2019 3:50:02 PM(UTC)  | Reason: Not specified

Online thomas  
#2 Posted : Friday, November 29, 2019 4:38:56 PM(UTC)
thomas

Rank: Paid support

Joined: 12/10/2013(UTC)
Posts: 464
Norway

Thanks: 22 times
Was thanked: 178 time(s) in 135 post(s)
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
Offline chris.hill@adsigroup.co.uk  
#3 Posted : Friday, November 29, 2019 4:46:20 PM(UTC)
chris.hill@adsigroup.co.uk

Rank: Paid support

Joined: 3/28/2018(UTC)
Posts: 21

Thanks: 6 times
Was thanked: 1 time(s) in 1 post(s)
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.
Online thomas  
#4 Posted : Monday, December 2, 2019 11:01:44 AM(UTC)
thomas

Rank: Paid support

Joined: 12/10/2013(UTC)
Posts: 464
Norway

Thanks: 22 times
Was thanked: 178 time(s) in 135 post(s)
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
Offline chris.hill@adsigroup.co.uk  
#5 Posted : Monday, December 2, 2019 2:05:31 PM(UTC)
chris.hill@adsigroup.co.uk

Rank: Paid support

Joined: 3/28/2018(UTC)
Posts: 21

Thanks: 6 times
Was thanked: 1 time(s) in 1 post(s)
Going forward it would only be for new emails hitting a mailbox.
Online thomas  
#6 Posted : Monday, December 2, 2019 2:40:39 PM(UTC)
thomas

Rank: Paid support

Joined: 12/10/2013(UTC)
Posts: 464
Norway

Thanks: 22 times
Was thanked: 178 time(s) in 135 post(s)
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.

thanks 2 users thanked thomas for this useful post.
Support on 12/2/2019(UTC), chris.hill@adsigroup.co.uk on 12/2/2019(UTC)
Offline chris.hill@adsigroup.co.uk  
#7 Posted : Monday, December 2, 2019 4:18:22 PM(UTC)
chris.hill@adsigroup.co.uk

Rank: Paid support

Joined: 3/28/2018(UTC)
Posts: 21

Thanks: 6 times
Was thanked: 1 time(s) in 1 post(s)
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.

Edited by user Monday, December 2, 2019 4:28:49 PM(UTC)  | Reason: Found answer to last question

Online thomas  
#8 Posted : Monday, December 2, 2019 4:52:48 PM(UTC)
thomas

Rank: Paid support

Joined: 12/10/2013(UTC)
Posts: 464
Norway

Thanks: 22 times
Was thanked: 178 time(s) in 135 post(s)
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.
thanks 1 user thanked thomas for this useful post.
chris.hill@adsigroup.co.uk on 12/2/2019(UTC)
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Scroll to Top