Importing gMail?

Sarah Reichelt sarah.reichelt at gmail.com
Fri Aug 14 19:18:13 EDT 2009


> However, there is something strange going on here (Mac OS 10.5.8 and Rev.
> 3.5 and 4) with your POP Library.
> When I click "Check mail" your stack begins to download emails from my Mac
> Mail account (from which I have forwarded my gMails). It begins with:
> Reading message 1 of 72, and them moves on to message 2 etc. until it
> reaches message 30 when it stops reading briefly and begins all over again
> from message 1.

Have a look at the checkForEmails handler in the "Read Emails" button.
The problem I am trying to avoid is that when you tell a POP server to
delete an email, it doesn't do it right away, but waits until the
connection is closed. This means that if you are reading email #999
out of 1000 and the connection fails, all those 999 emails have to be
re-read. So I read 30 at a time and then close the connection. If
there were more than 30 emails, it then re-schedules another check a
few seconds later to read more.

In your case, you do not have it deleting the read emails (a very good
idea during testing), so when it tries again, there are still 72
emails, so it reads the first 30 again.

I have just uploaded a new version to my site (after realising that
the previous upload had contained the library stack only and not the
demo stack).
I will read the first 30 emails as before, but if the "Delete emails"
checkbox is not checked, it will not then try to read again, so won't
get stuck in the infinite loop. You can find the new version here:
<http://www.troz.net/rev/>.


> Also, in looking through your scripts, I would like to be able to insert a
> conditional statement to download only email with a specific subject but I
> can't see where to inset this. Is this possible? Not critical; this can be
> done after the fact.

Yes, this is very easily done. Again, have a look in the script of the
"Read Emails" button and look for the "readMessage" handler. In the
new version, I have included a commented-out section that shows how
you can decide whether or not to download an email based on subject.
The libraray gets the top of the email which includes all the headers.
It uses this to extract the subject, sender and recipient, so can
decide whether to download based on these or on the size or UIDL of
the email.


> (By the way, the stack opens with the "Read emails" button disabled. Maybe a
> card script: On opencard \ set the disabled of button "Read emails" to false
> \ end opencard.)

Done :-)

Please feel free to email me off-list if you have any other questions
or if you would like me to make any modifications.

Cheers,
Sarah



More information about the use-livecode mailing list