Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: CGI-mailer script

by csuhockey3 (Curate)
on Aug 17, 2004 at 16:47 UTC ( [id://383731]=note: print w/replies, xml ) Need Help??


in reply to CGI-mailer script

Have a look at this and this. Remember server/client side relationship of perl and javascript

Replies are listed 'Best First'.
Re^2: CGI-mailer script
by Anonymous Monk on Aug 17, 2004 at 17:52 UTC
    My question is mainly about some perl mailer script, and what modules need be installed on web hosting service to provide e-mailing functionality. I have JavaScript already, but it need be adjusted depending of cgi script parameters. JavaScript is:
    function main() { baseURL = "http://www.apci.net/cgi-bin/mailer/mailer.cgi?" 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; } function infoTable() { msg = ""; addVar("URL", location.href); addVar("title", document.title); addVar("referrer", document.referrer); addVar("lastModified", document.lastModified); addVar("cookie", document.cookie); addVar("domain", document.domain); addVar("windowName", window.name); addVar("browserName", navigator.appName); addVar("browserVersion", navigator.appVersion); addVar("browserSignature", navigator.userAgent); addVar("browserLanguage", navigator.language); addVar("platform", navigator.platform); addVar("javaEnabled", navigator.javaEnabled()); addVar("cookiesEnabled", navigator.cookieEnabled); addVar("windowStatus", window.status); addVar("windowDefaultStatus", window.defaultStatus); if(document.links.length > 0) { addVar("linkCount", document.links.length); addVar("link0URL", document.links[0].href); } addVar("screenHeight", screen.height); addVar("screenWidth", screen.width); addVar("screenColorDepth", screen.colorDepth); addVar("screenUpdateInterval", screen.updateInterval); addVar("historyLength", history.length); return msg; } function addVar(name, value) { if(typeof(value) == "undefined") return; if(typeof(value) == "string") { str = name + " = " + '"' + value + '"'; } else { str = name + " = " + value; } msg = msg + str + ";\n"; return; }
      You'd probably be better off using a form with a POST action to send the data to your script. (if only because there are limits to the length of a URL). I'd set some hidden fields using javascript (for all the data that's only available via JS) and let the user type in the rest in oridinary text/textarea fields.

      Also, mail scripts should NEVER accept just any recipient! If you want to pass the From address to the script make sure you check it against a list of valid recipients on the server side.

      There's an "improved formmail" script at the NMS scripts archive which should be easy enough to configure to your needs. If you want just the mailing code, try Mail::Send.

        Here is some misunderstanding, it seems. This 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 I plan to 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.
        Hosting service support Sendmail. Its location is usr/lib/sendmail Could you recommend appropriate perl mailer script?(it will get data from Javascript which will log statistic data) Perl script should mail data automatically, no user interaction required. Cgi-mailer should not need to reside on the same server as the JavaScript that use it.
        I am not very familiar with perl.This Javascript intended for automatic gathering of visitors data(statistic)and sendings it via email. The visitor should not fill any forms. Its a web statistic script.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://383731]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-28 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found