Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Use LWP to access gmail messages

2 views
Skip to first unread message

Alicourant KOTE

unread,
May 11, 2018, 7:15:02 PM5/11/18
to lib...@perl.org

Hi everybody,

I am new to perl but think I love it.

How can I use LWP to access the google mail web page, select uread messages and display them directly in the gmail?

I do not want to save them somewhere. Just make gmail display the unread messages.

 

Here are steps:

1.      Run Google Chrome;

2.      Go to the page http://www.google.com, this will display the page https://www.google.com;

3.      Find and clic on gmail button in this page;

4.      Wait until all the page loads;

5.      Select my account in a displayed form (there is a list of 2 accounts in a that form: one is my wife’s account) and clic on it;

6.      Fill in my password and clic Next

7.      When all messages are completely loaded, display only those unread.

 

I do not want to use WWW:Mechanize because it does not deal will javascript.

Can hope to be helped?

 

Anyway thanks a lot.

 

A.KOTE

David Pottage

unread,
May 12, 2018, 4:45:02 AM5/12/18
to lib...@perl.org
The the usual answer to this would be to use Mechanize or HTML::Tree builder, but in either case it will be hard because of JavaScript, and because those web pages are designed for human interaction, not to be parsed by scripts.

In the case of gmail email, the easiest approach would be to access the mailbox using the IMAP protocol. See
Mail::IMAPClient. This will avoid using a web browser of any sort, and instead use a protocol that is designed for use by scripts and other programs.

You may have to adjust the security settings on your gmail account so that IMAP access is permitted.

--
David Pottage

Shlomi Fish

unread,
May 12, 2018, 5:00:03 AM5/12/18
to Alicourant KOTE, lib...@perl.org
Hi A!

Please reply to list if it's a mailing list post - http://shlom.in/reply .
See http://perl-begin.org/uses/web-automation/ and
https://metacpan.org/release/WWW-Mechanize-Chrome . LWP does not deal with JS
either.

Regards,

>
>
> Anyway thanks a lot.
>
>
>
> A.KOTE
>



--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
http://www.shlomifish.org/humour/bits/New-versions-of-the-GPL/

Take your schedule estimates and multiply them by Pi. Take your expected
profits and divide them by Pi.
— My father’s mentor’s advice

Please reply to list if it's a mailing list post - http://shlom.in/reply .

Daniel Wright

unread,
May 13, 2018, 4:00:02 PM5/13/18
to lib...@perl.org
An alternate solution if you want to be able to manage your email using all of the gmail specific features would be to use their API:


In which case, you might want to take a look at REST::Client.

-Dan
0 new messages