Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

CGI Scripts

  • 08-03-2005 3:01am
    #1
    Closed Accounts Posts: 290 ✭✭


    Apologies if this has been asked before (but the site search is offline at the mo) but does anyone know a a site providing fa ree CGI script for emailing me the contents of a simple web form?


Comments

  • Closed Accounts Posts: 7,488 ✭✭✭SantaHoe


    Yeah, google for Matt's FormMail.pl
    You'll need to know the location of the servers sendmail script to set it up, but the peeps you host with should be able to tell you this if it's not already in their FAQ.
    I think v1.92 is the most recent version of FormMail.pl so make sure you don't get anything older, as the older versions are apparently vulnerable to spammers using it to send unsolicited email through your site.
    It takes a bit of reading, but there's not that much to set up... only in the first few lines, and it's explained pretty well in the comments.
    The only annoying thing is the unix line breaks, so if you're editing it in windows be sure not to disturb them and try to work with the jumbled version :eek:
    I find it stops working if you disturb the line breaks, so notepad.exe with wordwrap off should do the trick.


  • Closed Accounts Posts: 154 ✭✭smorton


    #!/usr/local/bin/perl
    print "Content-type: text/html\n\n";
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $name =~ tr/+/ /;
    $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $FORM{$name} = $value;
    if($name eq "to"){$to="YOUR EMAIL ADDRESS"}
    if($name eq "from"){$from=$value}
    if($name eq "subject"){$subject=$value}
    if($name eq "body"){$body=$value}
    }
    open (MAIL,"|/usr/lib/sendmail -t");
    print MAIL "To: $to\n";
    print MAIL "From: $from\n";
    print MAIL "Subject: $subject\n\n";
    print MAIL "$body\n";
    close MAIL;


    that program is for emailing to ppl in general but it can be easily be modified by changing the lines:
    if($name eq "from"){$from=$value}
    to whatever you want. in the one above there were four text boxes in the form, called to, from subject and body. the line "open (MAIL,"|/usr/lib/sendmail -t");" is different depending on your host. thats the path for netfirms and i thik most hosts. also the from address can be put as whatever you want. good for some fun :)


Advertisement