Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Open URL from email message

Reply
Thread Tools

Open URL from email message

 
 
Lev Altshuler
Guest
Posts: n/a
 
      07-04-2003
Hi,

When reading from email message using Net:OP3 (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:OP3 or
anywhere else.
Does anyone have an idea how to do that?

Thanks, Lev


 
Reply With Quote
 
 
 
 
Lev Altshuler
Guest
Posts: n/a
 
      07-05-2003
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:OP3.
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" <(E-Mail Removed)> wrote in message
news:XLoNa.63680$(E-Mail Removed).. .
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lev Altshuler wrote:
> > Hi,
> >
> > When reading from email message using Net:OP3 (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:OP3 or
> > anywhere else.
> > Does anyone have an idea how to do that?
> >
> > Thanks, Lev

>
> Net:OP3 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-----
>



 
Reply With Quote
 
 
 
 
Steve Grazzini
Guest
Posts: n/a
 
      07-05-2003
Lev Altshuler <(E-Mail Removed)> wrote:

[ dejeopardized, follow-ups set to clpmisc ]

> "Mina Naguib" <(E-Mail Removed)> 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:OP3.
> 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
 
Reply With Quote
 
Beable van Polasm
Guest
Posts: n/a
 
      07-05-2003
"Lev Altshuler" <(E-Mail Removed)> 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:OP3.
> 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
 
Reply With Quote
 
Eric Schwartz
Guest
Posts: n/a
 
      07-07-2003
Beable van Polasm <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why don't links open from an email message or a news group message? Jeff Strickland Computer Information 9 04-10-2008 08:02 PM
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM
RE: The Web server reported the following error when attempting to create or open the Web project located at the following URL: <URL> =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?= ASP .Net 0 06-07-2004 07:36 AM
Open URL from email message Lev Altshuler Perl Misc 4 07-07-2003 10:49 PM



Advertisments