Hi,
Please I need your help.
I'm trying to make something out of a cgi form mail script.
I have everything workiing so far except for 1 little detail that is giving me a headache.
What I'm trying to accomplish is to have a form someone can fill out where they type in the begining of an email address in 1 field (ex johndoe) then from a drop down list select the second part (ex @you.com or @me.com) then fill out the other 2 fields and be able to send that to the approciate place. (either johndoe@you.com or johndoe@me.com).
If you look at my script below you can see where I'm trying grab the begining and end of the email. It runs without any errors, but I don't get the email sent to me. If I totally remove the second half and actually type in johndoe@you.com in the 1st field it will send an email their. I just can't get my selection drop down to work.
Can anyone help PLEASE! and THANKYOU!!
Part of the html form:
</HEAD>
<BODY>
<form action="http://anywho.com/cgi-bin/text.cgi" method="post">
<table border="0">
<TR>
<TD COLSPAN="2">Please fill in the details below to send us a message</TD>
</TR>
<TR>
<TD colspan="2"> </TD>
</TR>
<TR>
<TD align="left" width="20%"><B>Cell:</B></TD>
<TD><input type="text" name="first">
@<select name="second" size="1">
<option value="\@me.com" selected>Verizon</option>
<option value="@you.com">Cingular</option>
</select>
</TD>
</TR>
<TD align="left" width="20%"><B>Name:</B></TD>
<TD><input type="text" name="fname"></TD>
</TR>
<TR>
<TD align="left" width="20%"><b>Email Address:</b></TD>
<TD><input type="text" name="email_add"></TD>
</TR>
<TR><TD ALIGN=left valign="top" width="20%"><b>Message:</b></TD>
<TD><textarea name="email_msg" rows="20" cols="30"></textarea></TD>
</TR>
<TR>
<TD colspan="2"> </TD></TR>
<TR><TD colspan="2"><center><INPUT TYPE="submit" VALUE="Send Message"></center></TD>
</TR>
</TABLE>
</form>
Part of the cgi:
#!/usr/bin/perl
use strict;
use CGI;
my $cgiobject = new CGI;
my $fname=$cgiobject->param("fname");
my $email_add=$cgiobject->param("email_add");
my $email_msg=$cgiobject->param("email_msg");
my $MailProgram = '/usr/lib/sendmail';
my $cell =$cgiobject->param("cell","where");
print "Content-type: text/html\n\n";
open (MAIL,"|$MailProgram -t") || &errormess;
print MAIL "To: $cell\n";
print MAIL "From: $email_add\n";
print MAIL "Reply-to: $email_add\n";
print MAIL "Subject: Email From Your Website\n";
print MAIL "Name $fname\n";
print MAIL "email $email_add\n";
print MAIL "Msg $email_msg\n";
close(MAIL);
Please I need your help.
I'm trying to make something out of a cgi form mail script.
I have everything workiing so far except for 1 little detail that is giving me a headache.
What I'm trying to accomplish is to have a form someone can fill out where they type in the begining of an email address in 1 field (ex johndoe) then from a drop down list select the second part (ex @you.com or @me.com) then fill out the other 2 fields and be able to send that to the approciate place. (either johndoe@you.com or johndoe@me.com).
If you look at my script below you can see where I'm trying grab the begining and end of the email. It runs without any errors, but I don't get the email sent to me. If I totally remove the second half and actually type in johndoe@you.com in the 1st field it will send an email their. I just can't get my selection drop down to work.
Can anyone help PLEASE! and THANKYOU!!
Part of the html form:
</HEAD>
<BODY>
<form action="http://anywho.com/cgi-bin/text.cgi" method="post">
<table border="0">
<TR>
<TD COLSPAN="2">Please fill in the details below to send us a message</TD>
</TR>
<TR>
<TD colspan="2"> </TD>
</TR>
<TR>
<TD align="left" width="20%"><B>Cell:</B></TD>
<TD><input type="text" name="first">
@<select name="second" size="1">
<option value="\@me.com" selected>Verizon</option>
<option value="@you.com">Cingular</option>
</select>
</TD>
</TR>
<TD align="left" width="20%"><B>Name:</B></TD>
<TD><input type="text" name="fname"></TD>
</TR>
<TR>
<TD align="left" width="20%"><b>Email Address:</b></TD>
<TD><input type="text" name="email_add"></TD>
</TR>
<TR><TD ALIGN=left valign="top" width="20%"><b>Message:</b></TD>
<TD><textarea name="email_msg" rows="20" cols="30"></textarea></TD>
</TR>
<TR>
<TD colspan="2"> </TD></TR>
<TR><TD colspan="2"><center><INPUT TYPE="submit" VALUE="Send Message"></center></TD>
</TR>
</TABLE>
</form>
Part of the cgi:
#!/usr/bin/perl
use strict;
use CGI;
my $cgiobject = new CGI;
my $fname=$cgiobject->param("fname");
my $email_add=$cgiobject->param("email_add");
my $email_msg=$cgiobject->param("email_msg");
my $MailProgram = '/usr/lib/sendmail';
my $cell =$cgiobject->param("cell","where");
print "Content-type: text/html\n\n";
open (MAIL,"|$MailProgram -t") || &errormess;
print MAIL "To: $cell\n";
print MAIL "From: $email_add\n";
print MAIL "Reply-to: $email_add\n";
print MAIL "Subject: Email From Your Website\n";
print MAIL "Name $fname\n";
print MAIL "email $email_add\n";
print MAIL "Msg $email_msg\n";
close(MAIL);