Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send email, when link is clicked?

Status
Not open for further replies.

CraigHappy

Technical User
Jun 1, 2005
92
GB
Hi

I'm trying to find a cgi/perl script that will send an email, when an external web link is clicked.
(a different email address is needed for different web links)

Any ideas anyone?

Many thanks

Craig.


 
Hi

Craig said:
I'm trying to find a cgi/perl script that will send an email, when an external web link is clicked.
You want this as a "side effect" of the clicking ? So the browser to follow that link, but a mail to be also sent ? Then this is fact two half problems :
[ul]
[li]client side scripting to handle the clicking event, try in forum216 ( JavaScript )[/li]
[li]server side scripting to send the mail, try googling[/li]
[/ul]

Feherke.
 
Hi

And what to see there ? Their demo generate only a HTTP 500 error.

I think they provide just a forwarder script to use as
[tt]<a href="/cgi-bin/forward.cgi?url=http://www.example.com/">go to example</a>[/tt].

If this is what you want, name a scripting language accepted to run on your server.

Note : There are some browser extensions and bookmarklets to rewrite such URLs, skipping the forwarder script.

Feherke.
 
Hi feherke

Thanks for the info, my knowledge on programming is very limited. Not sure what you mean by -
browser extensions and bookmarklets to rewrite such URLs, skipping the forwarder script.?

I think my problem with this script lies in the sendmail command, basically there is a .cgi script that has a admin area which opens in a browser where I can view the clicked links and add emails to those links, so that a email notification can be sent to the owner of that url everytime a link is clicked.

I have the script in my cgi-bin and this is what I have for the config.pl page -

$password_location=qq|.adminpass|;
$bordercolor = qq|eae3e2|;
$stylesheet = qq|$forwarderror = qq|$cellpadding = qq|5|;
$cellspacing=qq|0|;
$email_site_on_click=qq|1|;
$emailstats=qq|1|;
$mailprog = qq|/usr/sbin/sendmail -mydomain.com|;
$myemail = qq|webmaster\@mydomain.com|;
$logdir=qq|logs|;
$refdir=qq|reflogs|;
$subject=qq|Your site has been visited!|;
$body=qq|Someone has clicked through to your site from $trowit=qq|0|;


1;

I use my own domain name where mydomain is stated.

This is what my remote web host company support advised for sendmail -

But I receive no emails advising that links have been clicked on when testing with my own links and email addresses?

Any suggestions would be very helpful.

Kind regards

Craig.
 
Your Mailprog variable isn't correct. Per your Host, you need the following:

streamline.net said:
/usr/sbin/sendmail -fuser@domainname.co.uk

You need to replace -fuser@domainname.co.uk with a valid mailbox on your account:

ie -froot@yourdomain.co.uk

Change $mailprog to be:

Code:
$mailprog = qq|/usr/sbin/sendmail -webmaster@mydomain.com\;

You can however, replace webmaster with a different account name if you'd like (link-bot@mydomain.com), just be sure to set that account up in your mail administration section.

- George
 
Thanks Guys

I'm not sure if the problem lies with the script of my hosting companies security features?
(I've got no other cgi-bin capable web space to test the script on)

As Rieekan confirmed, this is what my hosting company said I needed to add for security issues, it had to be linked with one of my email accounts with them -

'you need to do -fwebmaster@mydomainname.com'

So this is what I ended up with -

$mailprog = qq|/usr/sbin/sendmail -fwebmaster@mydomainname.com|;
$myemail = qq|webmaster@mydomainname.com|;

But, still doesn't work, the links are being clocked, but no emails are being sent out?

Basically I was after a script that I could use with my already existing few thousand url's.
The 'Link Tracker' script worked nearly ok, it allowed me just to add a little extra to the front of the urls, eg, but I'm having big problems getting the sendmail bit to work, this would send an email to the customers every time their url link was clicked.

The script in very simple terms allows every customers url to be logged every time a user clicks on it and emails the customer to advise them that this has happened.
I can view logs and add emails to send to, from within an online admin area, viewable from a browser.

So I'm looking for a new script or maybe see about getting one customized for the job in hand?

Any suggestions, very welcome.

Many thanks, Craig.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top