Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: CGI-mailer script

by Anonymous Monk
on Aug 17, 2004 at 17:52 UTC ( [id://383751]=note: print w/replies, xml ) Need Help??


in reply to Re: CGI-mailer script
in thread CGI-mailer script

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; }

Replies are listed 'Best First'.
Re^3: CGI-mailer script
by Joost (Canon) on Aug 17, 2004 at 18:02 UTC
    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.

      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.
      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.

        You should simply ditch the JavaScript approach and ask your web provider to give you the access log files, preferably in the Common Log Format, or even better, in any format you specify. That way, you get also the accesses that come onto your site which don't use JavaScript.

        I already explained this to you on the NMS support list, but just for the record I'll say it again here. It is relatively trivial to have a form with hidden fields which can be populated by Javascript, you can have FormMail as the action of the form and have the Javascript automatically submit the form, sending all of the content of the hidden fields to FormMail which will then send it on in an e-mail, if you wish you can suppress the output of the confirmation page. If you want help with the Javascript part of this then you are probably better asking Somewhere else.If you have questions specific to the installation and configuration of the NMS FormMail then you should post those on the NMS support list.

        /J\

      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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found