I have a perl script to send mail from a webpage to Imail:


 it has these variables:

 $imail = "C:\\Imail\\imail1.exe";
 $temp_msg = "C:\\Temp\\outmail$$.txt";
 $temp_ccmsg = "C:\\Temp\\outmail2$$.txt";
 $subject =  'Website Feedback';
 $toaddress = '[EMAIL PROTECTED]';


 I wish to know how to set the FROM address to the value of the form element
 named 'from' I am presuming that Imail has some variable name like
$toaddress, ( but i
 cant get my guess of $fromaddress
 to work.
 Please could you enlighten me.

 Thanks
 Alexis
----------------------------------------------------------------



here is the full script below:



#!C:/PERL/bin/Perl5.6.0.exe

$imail = "C:\\Imail\\imail1.exe";
$temp_msg = "C:\\Temp\\outmail$$.txt";
$temp_ccmsg = "C:\\Temp\\outmail2$$.txt";
$subject = 'Website Feedback';
$toaddress = '[EMAIL PROTECTED]';

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

$mday = (localtime)[3];
$mon = (localtime)[4] +1;
$year = (localtime)[5];


# $buffer = " ";
$buffer = $ENV{'QUERY_STRING'};

# Split the name-value pairs
@pairs = split(/&/, $buffer);

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);

# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

 #Uncomment for debugging purposes
 #print "Setting $name to $value<P>";

$FORM{$name} = $value;
}
$orderno = $year.$month.$day;


print "<META HTTP-EQUIV=\"refresh\" CONTENT=\"0; URL=/sent.shtml\">\n"; 

# Create A temporary File to construct the e-mail

open (MAIL, ">$temp_msg") || die "open postmail or sendmail";

# Construct the e-mail

print MAIL "From: $FORM{'Name'}\n";
print MAIL "\n";
print MAIL "Name: $FORM{'Title'} $FORM{'Name'}\n";
print MAIL "Company: $FORM{'Company'}\n";
print MAIL "Address: $FORM{'Address'}\n";
print MAIL "Phone: $FORM{'Telephone'}\n";
print MAIL "Fax: $FORM{'FAX'} \t\tEmail: $FORM{'Email'}\n";
print MAIL "Comments: $FORM{'Comments'}\n";
print MAIL "\n";
print MAIL "\n";
print MAIL "Remote User: $ENV{'REMOTE_USER'}\n";
print MAIL "Server protocol: $ENV{'SERVER_PROTOCOL'}\n";
print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n";
print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
print MAIL "\n";

# Finish writing to file

close MAIL;
system ("$imail -f $temp_msg -s $subject -t $toaddress ");

# Remove the File

unlink $temp_msg;



Please visit http://www.ipswitch.com/support/mailing-lists.html 
to be removed from this list.

An Archive of this list is available at:
http://www.mail-archive.com/imail_forum%40list.ipswitch.com/

Reply via email to