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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI mailer script 1

Status
Not open for further replies.

selenus

MIS
Apr 11, 2004
86
LV
Could someone recommend simple and convenient CGI-mailer script? It function is send web statistic logs by email, and it will work with JavaScript which will take all statistic about web site visitors. To adjust JavaScript, I need know CGI-mailer parameters.

Thanks
 
Some amplification: the JavaScript is website visitors logger, it collects the visitors data and then should pass data to cgi-mailer. All this automatically, visitors should not type/fill any forms. CGI-mailer script task is just mail data to my email. Web host on which will be set CGI-mailer, supports the net::smtp. The JavaScript will be placed on another web host, not on the same host with CGI-mailer. What CGI-mailer I can use and how to configure cgi-mailer and JavaScript itself? I am not familiar with Perl.
 
Some research for you so,

faq219-364
faq219-1563
faq219-2111
faq219-2901

HTH
--Paul



It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
you need to write your perl script that will send the message.

Next you will have to write a javascript that takes the infomation. Create a url encoded message and sends it to the script that then parses and send the info.
 
Let assume, I find this scripts:
a)using sendmail
b)without sendmail

My Javascripts start from:

{

baseURL = "mailTo="name@mydomain.com";
mailFrom="";
SendMsg(mailTo, mailFrom, "Testing", infoTable());
return;

}
function SendMsg(to, from, subject, msg)

{

Question: how to "create a url encoded message and sends it to the script that then parses and send the info"?
 
function SendMsg(to, from, subject, msg)

int myurl = 'to = escape(to);
from = escape(from);
subject = escape(subject);
msg = escape(msg);
myurl = url + 'to='+to+'&from='+from+"&subject="+subject+"&msg="+msg;

//heres the part that Im not to sure about
location.url = url; //this will redirect the page so you would have to open a popup with the above url then close it
{

an additional note if you are collecting env data ie the plaform, os, browser that type of stuff it can be done much easier with perl.
 
I would like use formmail.pl script to send the email message.
It there a way to adjust that formmail script that it send mail each time when the javascript code referred to this perl script? Formmail script need send email when Javascript code reffers to that script from html document.
Here is part of javascript code that reffers to cgi script:

function main()

{

baseURL = "mailTo="name@mydomain.com";
mailFrom="";
SendMsg(mailTo, mailFrom, "Testing", infoTable());
return;

}
function SendMsg(to, from, subject, msg)

{

var sendmail_hack, URL;

sendmail_hack = new Image();

URL = baseURL;
URL = URL + "TO=" + escape(to) + "&";
URL = URL + "SUBJECT=" + escape(from + " " + subject) + "&";
URL = URL + "msg=" + escape(msg);
sendmail_hack.src = URL;
return;

}
 
you can't just refer to a cgi you have to send a request. When you send a request the browser exspects a answer and the server sends a response for that expectation. What you are trying to do is create a work around for what browsers were designed to do. It can be done but it isn't going to as easy as just "referring" to the script. Which is why I said open a popup to recieve the response then close the popup. Negative aspects are that if popups are blocked things will not work as you have planned.

And Like I said before any information that you can get with javascript you can get with perl then email it from the same script.
 
But I want use that javascript not only on html page, but also in html email; the javascript can be inserted directly in email body, but the cgi-script - not, its only server side script.
 
I write scripts almost daily that include javascript into html pages.

why dont you include an example of the type of data that you are trying to use in you web page/s.
 
I would like use that javascript also in html emails. What cgi script I should use to interface this javascript with? (the piece of javascript code has shown in top)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top