Author Topic: Webpage design hellp; CGI EMail  (Read 495 times)

Offline Wotan

  • Platinum Member
  • ******
  • Posts: 7201
Webpage design hellp; CGI EMail
« on: December 17, 2004, 02:45:42 AM »
What I have is an HTML form (squad recruiting application) and I want the applicant to just fill it out click on submit and have the form be emailed off to the Recruiting officer.

Here's a link to the form:

http://4jg53.netprism.net/form.html

As I understand it I create an 'email' template and save it as ASCII text.

But damned if I can get it to work correctly.

I was using this page as a reference:

http://web.mit.edu/wwwdev/cgiemail/user.html

Any help would be appreciated...

Offline Saintaw

  • Platinum Member
  • ******
  • Posts: 6692
      • My blog
Webpage design hellp; CGI EMail
« Reply #1 on: December 17, 2004, 02:55:03 AM »
Don't have much time right now, but here it goes:

The last CGI I used for sending an email is here, bmake sure your file is executable!


#!/usr/bin/perl -wT
use CGI qw(:standard);
#use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;

print header;
print start_html("");

my %form;
my $send_bcc;
my $send_subject;
my $send_msg;
my $send_from;
my $send_raid;
$send_from="myemailaddress\@mydomain.com";
foreach my $p (param()) {
    $form{$p} = param($p);
    #print "$p = $form{$p}
\n";
    if ($p eq "send_bcc") {
    $send_bcc=$form{$p};
  }
    if ($p eq "subject") {
    $send_subject=$form{$p};
  }  
    if ($p eq "msg") {
    $send_msg=$form{$p};
  }  
    if ($p eq "raid") {
    $send_raid=$form{$p};
  }
}

sendmail($send_from,$send_bcc,$send_subject,$send_msg);

print end_html;

sub sendmail {
    my ($from, $bcc, $subject, $message) = @_;
    $ENV{PATH} = "/usr/lib";
    open (MAIL, "|/usr/lib/sendmail -oi -t") or
        &dienice("Can't fork for sendmail: $!\n");
    print MAIL "From: $from\n";
    print MAIL "Bcc: $bcc\n";
    print MAIL "Subject: $subject\n\n";
    print MAIL "$message\n";
    close(MAIL);
}
sub dienice {
    my($errmsg) = @_;
    print "

Error

\n";
    print "

$errmsg

\n";
    print end_html;
    exit;
}



In here the variables "$send_bcc,  $send_subject, $send_msgetc..." are defined by the form fields, up to you to change them.

If you can't get it to work, send your script to saw_at_onpoi_dot_net. I'll get around it this week end.

OT:
For the options:

 Yes, I have a mic and use Teamspeak.
No, I dont have a mic.
I have a mic but I cannot get Teamspeak to work.


Use an input type "radio" instead of an input type "checkbox" if you want your users to select only one option.
Saw
Dirty, nasty furriner.

Offline Wotan

  • Platinum Member
  • ******
  • Posts: 7201
Webpage design hellp; CGI EMail
« Reply #2 on: December 17, 2004, 03:00:19 AM »
Thanks Saw...

I will give it a few more tries...

Just keep keep your email open :)

Offline montag

  • Parolee
  • Copper Member
  • **
  • Posts: 164
Webpage design hellp; CGI EMail
« Reply #3 on: December 17, 2004, 03:06:48 AM »
If I remember right, cant have name of a variable with a space.

NAME=someuniqname nospace

You seem to have alot of those.  everything else looksok. I believe its all passed to the cgi as one long string.

Offline Saintaw

  • Platinum Member
  • ******
  • Posts: 6692
      • My blog
Webpage design hellp; CGI EMail
« Reply #4 on: December 17, 2004, 04:17:26 AM »
Wotan, I have no access to my private email when in the office, If you are waiting for an answer it won't be before tomorrow.

Montag is right: No space in field names, EVAR! use "_" instead.
Saw
Dirty, nasty furriner.

Offline Wotan

  • Platinum Member
  • ******
  • Posts: 7201
Webpage design hellp; CGI EMail
« Reply #5 on: December 17, 2004, 04:23:33 AM »
Quote
Originally posted by Saintaw
Wotan, I have no access to my private email when in the office, If you are waiting for an answer it won't be before tomorrow.

Montag is right: No space in field names, EVAR! use "_" instead.


No, I haven't sent you anything. I will try to get it figured out later today after I get home from work and if I need help I will email you this weekend.

Thanks for the help!!!

Offline jetb123

  • Silver Member
  • ****
  • Posts: 1807
Webpage design hellp; CGI EMail
« Reply #6 on: December 17, 2004, 01:14:27 PM »
If that doesnt work I think you got to use something called ASP. It does somthing to the server.

Offline Saintaw

  • Platinum Member
  • ******
  • Posts: 6692
      • My blog
Webpage design hellp; CGI EMail
« Reply #7 on: December 17, 2004, 03:35:33 PM »
Quote
Originally posted by jetb123
If that doesnt work I think you got to use something called ASP. It does somthing to the server.

:D
Saw
Dirty, nasty furriner.

Offline Eagler

  • Plutonium Member
  • *******
  • Posts: 18798
Webpage design hellp; CGI EMail
« Reply #8 on: December 17, 2004, 03:42:09 PM »
"Masters of the Air" Scenario - JG27


Intel Core i7-13700KF | GIGABYTE Z790 AORUS Elite AX | 64GB G.Skill DDR5 | 16GB GIGABYTE RTX 4070 Ti Super | 850 watt ps | pimax Crystal Light | Warthog stick | TM1600 throttle | VKB Mk.V Rudder

Offline Wotan

  • Platinum Member
  • ******
  • Posts: 7201
Webpage design hellp; CGI EMail
« Reply #9 on: December 18, 2004, 05:30:40 AM »
Thanks guys I got what I want up...

Offline Saintaw

  • Platinum Member
  • ******
  • Posts: 6692
      • My blog
Webpage design hellp; CGI EMail
« Reply #10 on: December 19, 2004, 01:51:40 AM »
:cool:
Saw
Dirty, nasty furriner.