Re: Use LWP to access gmail messages

[email protected] (David Pottage)
Newsgroups perl.libwww
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.