Page 1 of 1

Receive emails via livecode

Posted: Mon Mar 11, 2013 5:41 pm
by FireWorx
So Ive searched google, the forum and the IOS release notes.

My question is is there a way to monitor e-mails or text messages that are incoming and if it is from a specific user open the email or text and mine some data from it? I see the ability to compose and send text and emails but not receive them in this fashion. Perhaps this is just asking to much?
Dave

Re: Receive emails via livecode

Posted: Tue Mar 12, 2013 6:09 am
by shaosean
You need a POP3 library to access emails on the server.. I would recommend one that can do the TOP command so you just grab the headers to look for the messages you want to retrieve completely from the server.. The POP3 part is easy, decoding of the email messages is the pain (good old MIME)..

Re: Receive emails via livecode

Posted: Fri Dec 13, 2013 9:48 pm
by LC4iOS
I'd like to pursue this further.
I'm looking thru the TROZ libraries now.
Has anyone got a hyperlink for further research?

Wow!
Upon further research into this library,
looks like everything I'm looking for is already there.
Release in 2010 and seems like no further updates were necessary.
Very cool

Re: Receive emails via livecode

Posted: Wed Dec 18, 2013 8:02 am
by LC4iOS
Just sharing ...

Added a get DateAndTime routine - this worked for two difference email servers
and fixed the Clear script to include enabling Read emails button

Error: Sorry, the board attachment quota has been reached.

At the moment it seems that out of 19 emails only 12 are getting saved to text files.
I'm sure they are 7 duplicates.
Not sure if we care.
I'll probably change the file name to reflect the DateAndTime received.

Re: Receive emails via livecode

Posted: Fri Dec 20, 2013 9:08 am
by LC4iOS
Is there a way to uniquely identify emails from the headers?
I thought Date Time From Subject.

Is there a UID somewhere in the email headers?

Found it.
Message-ID: 20050329231145.62086.mail@mail.emailprovider.com
A unique number assigned by mail.emailprovider.com to identify the message.

Its where I'm getting the Date Time
yyyymmddhhmmss.etc

Re: Receive emails via livecode

Posted: Fri Dec 20, 2013 10:23 am
by SparkOut
Careful with the date extraction there - the message ID is not a standard format, afaik, it is just a string that identifies individual messages and I believe the sender's service can generate whatever string it chooses by its own rules. Messages from sources other than your test may not have the same ID generator.
That example header - did you get that from a real message? Was it really sent in 2005?

Re: Receive emails via livecode

Posted: Fri Dec 20, 2013 10:20 pm
by LC4iOS
Thanks SparkOut.

I was sure to mention it worked on my two providers so far.

l'll sort the date time stamp out when the situation arrises.
I do see another verbose date with GMT offset.
I'll have to see if there is an example of coverting it to sql date n time here on livecode forums.

That example header is just an example.

Still can't upload my projects.

Re: Receive emails via livecode

Posted: Sat Dec 21, 2013 3:09 am
by LC4iOS
LiveCode makes everything look easy.
But user contribution make LiveCode ROCK!

Code: Select all

convert "Sat, 21 Dec 2013 12:54:29 +1100" from internet date to short date and short time
   
   answer it
   
   convert "Sat, 21 Dec 2013 12:54:29 +1100" from internet date to dateItems
   
   answer it
   
   answer the internet date
   
   convert the internet date from internet date to dateItems
   
   answer it

Re: Receive emails via livecode

Posted: Sat Dec 21, 2013 11:08 pm
by LC4iOS
Some of the email subjects are returning strange content:

=?windows-1252?Q?Academics_Save_50%_on_Valentina_Studio_Pro?=

Its easy enough to clean up but I was just wondering what this encoding is?

All messages are mime type v1.
Even the ones without this strange content.

Re: Receive emails via livecode

Posted: Sat Dec 21, 2013 11:29 pm
by FourthWorld
Just another example of Microsoft not adopting common standards - apparently they felt ISO 8859-1 wasn't good enough for them:
http://en.wikipedia.org/wiki/Windows-1252