develooper Front page | perl.libwww | Postings from May 2018

Re: Use LWP to access gmail messages

Thread Previous | Thread Next
From:
David Pottage
Date:
May 12, 2018 08:28
Subject:
Re: Use LWP to access gmail messages
Message ID:
35f4a563-36f1-236f-7b06-34952c20c29f@electric-spoon.com
On 11/05/18 21:47, Alicourant KOTE wrote:
>
> 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?
>

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


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About