Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl (http://www.velocityreviews.com/forums/f17-perl.html)
-   -   Open URL from email message (http://www.velocityreviews.com/forums/t24126-open-url-from-email-message.html)

Lev Altshuler 07-04-2003 11:19 PM

Open URL from email message
 
Hi,

When reading from email message using Net::POP3 (or other means),
I need my perl program to open URLs incuded into the message. In other
words, I need the program to click links in the message.
So far I have not found the solution for that either in Net::POP3 or
anywhere else.
Does anyone have an idea how to do that?

Thanks, Lev



Lev Altshuler 07-05-2003 01:51 AM

Re: Open URL from email message
 
Internet Explorer can be launched with the following system call:
system("start $url");
where $url is a variable where we stored URL read by Net::POP3.
But the task is to emulate a click on the link from email message. Launching
the browser is not
an issue here. I am not certain that launching the browser as I described
above will emulate
a click on the link from email message.

"Mina Naguib" <spam@thecouch.homeip.net> wrote in message
news:XLoNa.63680$0B.1038336@wagner.videotron.net.. .
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lev Altshuler wrote:
> > Hi,
> >
> > When reading from email message using Net::POP3 (or other means),
> > I need my perl program to open URLs incuded into the message. In other
> > words, I need the program to click links in the message.
> > So far I have not found the solution for that either in Net::POP3 or
> > anywhere else.
> > Does anyone have an idea how to do that?
> >
> > Thanks, Lev

>
> Net::POP3 handles, obviously, the POP3 protocol. In other words,

"download this chunk of text, it
> should resemble something parse-able by an email client as an email

message".
>
> That's all there is to it, a chunk of text in an agreed-on format.
>
> Anything beyond that, you have to do yourself. If you expect that chunk

of message to have URLs
> that you are interested in, then you need to extract these URLs. For

simple text emails, you can
> probably get away with using a simple regular expression to collect the

URLs. For HTML-encoded
> emails, you can probably use HTML::TokeParser to cleanly extract links.
>
> Once you have the URLs (still, chunks of text) in a variable somewhere,

you want to simulate a
> "click". In other words, you want to launch a web browser that visits

these URLs.
>
> Fortunately, perl comes with what you need. Look into any of the LWP*

family of modules. For simple
> GET requests with no further interaction, LWP::Simple might be what you're

looking for.
>
> Best of luck.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQE/Bhh3eS99pGMif6wRAvX6AJ9SgfwHu7BoyeKvW2QXrYkr2Us7oA CglhRw
> CZqJOuOT4wA+yt2t866cBic=
> =Vz0g
> -----END PGP SIGNATURE-----
>




Steve Grazzini 07-05-2003 02:10 AM

Re: Open URL from email message
 
Lev Altshuler <levalt@rogers.com> wrote:

[ dejeopardized, follow-ups set to clpmisc ]

> "Mina Naguib" <spam@thecouch.homeip.net> wrote:
>> Lev Altshuler wrote:
>>> I need my perl program to open URLs incuded into the message. In other
>>> words, I need the program to click links in the message.

>>
>> LWP::Simple might be what you're looking for.
>>

> Internet Explorer can be launched with the following system call:
> system("start $url");
> where $url is a variable where we stored URL read by Net::POP3.
> But the task is to emulate a click on the link from email message.

^^^^^^^^

Isn't it a little summery for homework?

> Launching the browser is not an issue here. I am not certain that
> launching the browser as I described above will emulate a click on
> the link from email message.


You can emulate a *click* on the link using return().

sub click {
my $thing = shift;
return;
}

This is approximately what mutt does when you click on anything,
and I think it's correct behavior.

HTH
--
Steve

Beable van Polasm 07-05-2003 02:16 AM

Re: Open URL from email message
 
"Lev Altshuler" <levalt@rogers.com> writes:

> Internet Explorer can be launched with the following system call:
> system("start $url");
> where $url is a variable where we stored URL read by Net::POP3.
> But the task is to emulate a click on the link from email message. Launching
> the browser is not
> an issue here. I am not certain that launching the browser as I described
> above will emulate
> a click on the link from email message.


You know, top-posting and full-quoting like that will get a lot of
people angry with you. You won't like it when a lot of people get
angry with you. Read this page to find out how to do it so that
everybody will accept your contributions:
http://www.netmeister.org/news/learn2quote2.html

As for "emulating a click", what other actions do you think that
clicking on a link would have than to get a web browser to display
the page linked to?


--
No, YOU'RE A CRACKPOT, which is why you think I'm a crackpot...
because all crackpots like you think everybody else is a moron
not them. -- George Hammond
http://beable.com

Eric Schwartz 07-07-2003 10:49 PM

Re: Open URL from email message
 
Beable van Polasm <beable+unsenet@beable.com.invalid> writes:
> As for "emulating a click", what other actions do you think that
> clicking on a link would have than to get a web browser to display
> the page linked to?


The answer, if it's HTML mail, and javascript is enabled, is "darn
near anything". If the machine in question runs Windows, even more
so.

-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.


All times are GMT. The time now is 02:20 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.