emails into Ebase

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

neilnewman
Ebase User
Posts: 201
Joined: Fri Dec 20, 2013 1:29 pm
Location: Dartford Borough Council
Contact:

emails into Ebase

#1

Postby neilnewman » Thu Aug 16, 2018 9:09 am

Is it possible for you to configure Ebase to recieve emails that you can then process via a script/form?
0 x

ericb
Ebase User
Posts: 82
Joined: Fri Jan 15, 2016 2:34 pm

Re: emails into Ebase

#2

Postby ericb » Thu Aug 16, 2018 2:57 pm

I sort of did this indirectly. I created a Java class that would fetch emails from a mailbox, parse them, and return whatever data my Ebase script would need. I created an Ebase form with a Before Form script that used this class and processed its return data, and a scheduled task to call that form once a day.
0 x

Ian
Ebase Staff
Posts: 26
Joined: Wed Oct 10, 2007 9:40 am
Location: Ebase HQ
Contact:

Re: emails into Ebase

#3

Postby Ian » Thu Aug 16, 2018 3:33 pm

I also have created a system to read emails into Ebase.
Rather than creating a Java class to do this I created the Java directly into my JavaScript.
I attached this script to the before form event of a form and then execute this form as a schedule executing every 30 seconds.
The parsed data is then written to a database table which in turn gets loaded into a form to display the emails.

I did it this way because my customer wanted to see a list of all the subject lines which when clicked showed the body of the email.
Also they wanted to know when an email had been read.

I have two versions of the script, one communicating with a pop3 email server and the other communicating with an exchange server.

Ian
0 x

neilnewman
Ebase User
Posts: 201
Joined: Fri Dec 20, 2013 1:29 pm
Location: Dartford Borough Council
Contact:

Re: emails into Ebase

#4

Postby neilnewman » Tue Aug 21, 2018 7:29 am

Hi Ian,
I don't supose the Exchange version of your code is available to share?

Many thanks
Neil
0 x

Ian
Ebase Staff
Posts: 26
Joined: Wed Oct 10, 2007 9:40 am
Location: Ebase HQ
Contact:

Re: emails into Ebase

#5

Postby Ian » Tue Aug 21, 2018 1:40 pm

Hi Neil,

I have attached a zip (rar) file containing the following:

Ebase server-side JavaScript
- processImapsEmail
- globalForImaps
- functions

They contain the javascript used in my application.
The processImapsEmail is the script that is attached to the before form event of my scheduled form.
The globalForImaps file is attached to the shared functions section of my scheduled form
The functions file is attached to the shared functions section of my scheduled form.

jsoup ( a jar file) needs to go into WEB-INF\lib
.
I use the jar file (jsoup) to extract the html portion of the email (if present).

If you have any difficulties please contact me.

mobile: 07834 101753

Regards

Ian
Attachments
ebase_email.rar
(358.07 KiB) Downloaded 260 times
0 x

neilnewman
Ebase User
Posts: 201
Joined: Fri Dec 20, 2013 1:29 pm
Location: Dartford Borough Council
Contact:

Re: emails into Ebase

#6

Postby neilnewman » Tue Aug 21, 2018 1:42 pm

Many thanks Ian, I will give it a go
0 x

Ian
Ebase Staff
Posts: 26
Joined: Wed Oct 10, 2007 9:40 am
Location: Ebase HQ
Contact:

Re: emails into Ebase

#7

Postby Ian » Tue Aug 21, 2018 1:53 pm

Hi Neal,

Just one thing - you will need to comment out the call to workflow in the "processImapsEmail" file.
Also you will see in this file (just after the workflow section) the following:

// move the message to the processed folder and
// then delete it form the receiving folder
var msgArray = [];
msgArray.push(message);
received.copyMessages(msgArray, processed);
message.setFlag(Flags.Flag.DELETED, true);

This section moves the email out of the receiving mail box (in my case POC) and into one of the sub folders.

Ian
0 x


Who is online

Users browsing this forum: Google [Bot] and 5 guests