Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have a mailto: link in html, which opens the email client. What I would like to to is create the link to a script say, <a href="email.pl">Click here</a> and this would generate some statistics for me and then open the email client.

use LWP::Simple qw/get/; my $content = get('mailto:me\@me.com'); warn "Couldn't get it!" unless defined $content; print $content;
doesn't work - is there anything that might?

Replies are listed 'Best First'.
Re: generate mailto: behaviour in a script
by moritz (Cardinal) on Oct 07, 2007 at 11:27 UTC
    It doesn't work that way, because the get is run on the server, but you want to open the mail client at the client.

    I have no idea if non-http redirects work, but you could try to send a redirect header (with CGI::redirect) with mailto:foo@bar.baz

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: generate mailto: behaviour in a script
by snopal (Pilgrim) on Oct 07, 2007 at 15:00 UTC

    To get the response you are outlining, it seems that you need a javascript onclick solution with DHTML communication (a.k.a. AJAX) with the server. You can then acquire the click data through a hidden process, and allow the client to continue with the browser based email client.