reesecup
08-06-2006, 05:59 PM
Hello, I have yet another problem. The sendmail module is not working for some reason. As usual I went over and over my code but I do not see anything wrong. Can someone tell what could be causing the problem? Thank you.
Here is the code:
#!/usr/bin/perl
#sendform.cgi - display web page and send form contents
print "Content-type: text/html\n\n";
use CGI qw(:standard -debug);
use strict;
use Mail::Sendmail;
#declare variables
my ($name, $tit, $company, $address, $snailmail, $City, $State, $Zip, $Phone, $Fax, $contact_how, $hear, $ques_comm, $msg, $fmsg, %fmail, %mail);
#declare values
$name = param('wname');
$tit = param('title');
$company = param('coname');
$address = param('maddress');
$City = param('city');
$State = param('state');
$Zip = param('zip');
$Phone = param('phone');
$Fax = param('fax');
$snailmail = param('email');
$contact_how = param('contact');
$hear = param('hearabout');
$ques_comm = param('comments');
#create message 1
$msg = "Thank you, $name. This message is a confirmation of your recent request.\n";
$msg = $msg . "We will respond to your request within 24 hours.";
#create message 2
$fmsg = "Name: $name\n";
$fmsg = $fmsg . "Title: $tit\n";
$fmsg = $fmsg . "Company: $company\n";
$fmsg = $fmsg . "Address: $address\n";
$fmsg = $fmsg . "City: $City\n";
$fmsg = $fmsg . "State: $State\n";
$fmsg = $fmsg . "Zip: $Zip\n";
$fmsg = $fmsg . "Phone: $Phone\n";
$fmsg = $fmsg . "Fax: $Fax\n";
$fmsg = $fmsg . "Email: $snailmail\n";
$fmsg = $fmsg . "Contact Me By: $contact_how\n";
$fmsg = $fmsg . "How did you hear about us?: $hear\n";
$fmsg = $fmsg . "Questions/Comments: $ques_comm";
#create acknowledgement
print "<HTML>\n";
print "<HEAD><TITLE>Request Submitted</TITLE></HEAD>\n";
print "<BODY BGCOLOR=BLACK>\n";
print "<IMG SRC=http://crux.baker.edu/tscott04/web211/gleamlogo00.gif><BR><BR><BR>\n";
print "<FONT COLOR=WHITE><H3>Thank you, $name. Your request was submitted successfully. You will receive an email confirmation shortly.<BR><BR>\n";
print "Here is the information you submitted:</H3>\n";
print "<b>Name: $name<BR>\n";
print "Title: $tit<BR>\n";
print "Company: $company<BR>\n";
print "Address: $address <BR>\n";
print "City: $City <BR>\n";
print "State: $State<BR>\n";
print "Zip Code: $Zip<BR>\n";
print "Phone: $Phone<BR>\n";
print "Fax: $Fax<BR>\n";
print "Email: $snailmail <BR>\n";
print "Contact Me By: $contact_how<BR>\n";
print "How did you hear about us?: $hear<BR><BR>\n";
print "Questions/Comments:<BR>\n";
print "$ques_comm </b></FONT><BR><BR>\n";
print "<CENTER><A HREF=http://crux.baker.edu/tscott04/web211/gleamklean2.shtml><FONT COLOR=RED>Return To Gleam Klean Home</FONT></A></CENTER> \n";
print "</BODY></HTML>\n";
my %mail = (
To => $snailmail,
From => 'tscott04@baker.edu',
Subject => 'Gleam Klean - Message Confirmation',
Message => $msg,
Smtp => 'email.baker.edu'
);
sendmail(%mail) or die $Mail::Sendmail::error;
my %mail = (
To => 'cscott153752MI@comcast.net',
From => 'tscott04@baker.edu',
Subject => 'Comments/Questions',
Message => $fmsg,
Smtp => 'email.baker.edu'
);
sendmail(%mail) or die $Mail::Sendmail::error;
Here is the code:
#!/usr/bin/perl
#sendform.cgi - display web page and send form contents
print "Content-type: text/html\n\n";
use CGI qw(:standard -debug);
use strict;
use Mail::Sendmail;
#declare variables
my ($name, $tit, $company, $address, $snailmail, $City, $State, $Zip, $Phone, $Fax, $contact_how, $hear, $ques_comm, $msg, $fmsg, %fmail, %mail);
#declare values
$name = param('wname');
$tit = param('title');
$company = param('coname');
$address = param('maddress');
$City = param('city');
$State = param('state');
$Zip = param('zip');
$Phone = param('phone');
$Fax = param('fax');
$snailmail = param('email');
$contact_how = param('contact');
$hear = param('hearabout');
$ques_comm = param('comments');
#create message 1
$msg = "Thank you, $name. This message is a confirmation of your recent request.\n";
$msg = $msg . "We will respond to your request within 24 hours.";
#create message 2
$fmsg = "Name: $name\n";
$fmsg = $fmsg . "Title: $tit\n";
$fmsg = $fmsg . "Company: $company\n";
$fmsg = $fmsg . "Address: $address\n";
$fmsg = $fmsg . "City: $City\n";
$fmsg = $fmsg . "State: $State\n";
$fmsg = $fmsg . "Zip: $Zip\n";
$fmsg = $fmsg . "Phone: $Phone\n";
$fmsg = $fmsg . "Fax: $Fax\n";
$fmsg = $fmsg . "Email: $snailmail\n";
$fmsg = $fmsg . "Contact Me By: $contact_how\n";
$fmsg = $fmsg . "How did you hear about us?: $hear\n";
$fmsg = $fmsg . "Questions/Comments: $ques_comm";
#create acknowledgement
print "<HTML>\n";
print "<HEAD><TITLE>Request Submitted</TITLE></HEAD>\n";
print "<BODY BGCOLOR=BLACK>\n";
print "<IMG SRC=http://crux.baker.edu/tscott04/web211/gleamlogo00.gif><BR><BR><BR>\n";
print "<FONT COLOR=WHITE><H3>Thank you, $name. Your request was submitted successfully. You will receive an email confirmation shortly.<BR><BR>\n";
print "Here is the information you submitted:</H3>\n";
print "<b>Name: $name<BR>\n";
print "Title: $tit<BR>\n";
print "Company: $company<BR>\n";
print "Address: $address <BR>\n";
print "City: $City <BR>\n";
print "State: $State<BR>\n";
print "Zip Code: $Zip<BR>\n";
print "Phone: $Phone<BR>\n";
print "Fax: $Fax<BR>\n";
print "Email: $snailmail <BR>\n";
print "Contact Me By: $contact_how<BR>\n";
print "How did you hear about us?: $hear<BR><BR>\n";
print "Questions/Comments:<BR>\n";
print "$ques_comm </b></FONT><BR><BR>\n";
print "<CENTER><A HREF=http://crux.baker.edu/tscott04/web211/gleamklean2.shtml><FONT COLOR=RED>Return To Gleam Klean Home</FONT></A></CENTER> \n";
print "</BODY></HTML>\n";
my %mail = (
To => $snailmail,
From => 'tscott04@baker.edu',
Subject => 'Gleam Klean - Message Confirmation',
Message => $msg,
Smtp => 'email.baker.edu'
);
sendmail(%mail) or die $Mail::Sendmail::error;
my %mail = (
To => 'cscott153752MI@comcast.net',
From => 'tscott04@baker.edu',
Subject => 'Comments/Questions',
Message => $fmsg,
Smtp => 'email.baker.edu'
);
sendmail(%mail) or die $Mail::Sendmail::error;