Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form mailing problems

Status
Not open for further replies.

iralh

Programmer
Sep 20, 2001
12
0
0
US
Hi,

I am having a problem with my form mailer. At the moment the script will send me a message but there are no contents. Where have I gone wrong?

script is:

#!c:\Perl\bin\Perl.exe -w
use strict;
use CGI ':standard';

my($to, $company, $name, $email, $problem1);
my $mailprog = 'c:\inetpub\scripts\we4.0\sendmail';

print "Content-type:text/html\n\n";

$to = 'ira@2cc.com';
$company = param('company');
$name = param('name');
$email = param('email');
$problem1 = param('problem1');

open (MAIL, "|$mailprog -t");
print MAIL "To: $to\n";
print MAIL "Subject: Service Request\n";

print MAIL "Company: $company\n";
print MAIL "Name: $name\n";
print MAIL "E-mail: $email\n";
print MAIL "Problem1: $problem1\n";

close (MAIL);

print '<head><style>body{font-family:verdana;font-size:10pt;}</style></head>';
print '<body><h3>Thank You!</h3> you will receive an email copy of this request.</body>';
 
You need to print a blank line between the headers (To and Subject) and the body of the email message. After the line where you print the subject header, add this:
Code:
print MAIL &quot;\n&quot;;
You could add the extra \n to the end of the subject header, but it you go back and add other headers (e.g. Bcc) and forgot to put it before the subject header or move the extra \n it would cause problems again. It's easier to maintain when you print the blank line by itself. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top