#!/usr/bin/perl -w use strict; use CGI; my $query = new CGI; my $thisurl = "http://www.my_site.com/cgi-bin/email.pl"; my $id_in=$query->param('id_in'); my $Guest_Email=$query->param('Guest_Email'); my $check=$query->param('check'); my ($Password,$U_Timestamp,$three,$four,$skipthisfield); my @emailer = (); my $data="/home/users/t/my_site.com-99078/data/edit/data.txt"; open (FILE, "$data"); while (my $line =) { ($Password,$U_Timestamp,$three,$four,$skipthisfield) = split "\t",$line; if ($id_in eq $three) { push (@emailer, $four); last; } } my $Email_address = join (" ", @emailer); $Email_address =~ s/@/\@/; print "Content-type: text/html\n\n"; print "Thank you:
\n
Detailss $id_in
\n"; print "three is: $three"; print "Email is: $Email_address
"; print "Check is: $check"; &sending(); #SEND EMAIL================================= sub sending { my $check; my $sendmailer; my $emailto; my $Email_address; my $emailfrom; my $message_no; my $message; $Email_address =~ s/@/\@/; if ($check == 0) { $sendmailer="/usr/sbin/sendmail"; $emailto="$Email_address"; $emailfrom="enquiry\@my_site.com"; open (MAIL, "| $sendmailer -t") || die "sendmailer: $!"; print MAIL "To: $emailto\n"; print MAIL "From: $emailfrom\n"; print MAIL "Subject: Request for information\n"; print MAIL "Content-type: text/html\n\n"; print MAIL "

\n"; print MAIL "\n"; print MAIL "REQUEST FOR INFORMATION

\n"; print MAIL "I am interested in receiving information on : $id_in
\n"; print MAIL "blah\n"; print MAIL "Any other comments:
\n"; print MAIL "$message
\n"; print MAIL "
\n"; last; close(MAIL); close(MAIL); } elsif ($check == 1) { $sendmailer="/usr/sbin/sendmail"; $emailto="$Guest_Email"; $emailfrom="enquiry\@my_site.com"; open (MAIL, "| $sendmailer -t") || die "sendmailer: $!"; print MAIL "To: $emailto\n"; print MAIL "From: $emailfrom\n"; print MAIL "Subject: Response from owner\n"; print MAIL "Content-type: text/html\n\n"; print MAIL "

\n"; print MAIL "\n"; print MAIL "You have a response from the owner of property: $id_in.
\n"; print MAIL "
\n"; print MAIL "Message follows:
\n"; print MAIL "$message

\n"; print MAIL "\n"; print MAIL "
\n"; last; close(MAIL); close(MAIL); } elsif ($check == 2) { $sendmailer="/usr/sbin/sendmail"; $emailto="$Email_address"; $emailfrom="enquiry\@my_site.com"; open (MAIL, "| $sendmailer -t") || die "sendmailer: $!"; print MAIL "To: $emailto\n"; print MAIL "From: $emailfrom\n"; print MAIL "Content-type: text/html\n\n"; print MAIL "

\n"; print MAIL "\n"; print MAIL "
\n"; print MAIL "Message follows:
\n"; print MAIL "$message

\n"; print MAIL "\n"; print MAIL "
\n"; last; close(MAIL); close(MAIL); #end of patch } elsif ($check == 3) { $sendmailer="/usr/sbin/sendmail"; $emailto="$Guest_Email"; $emailfrom="enquiry\@my_site.com"; open (MAIL, "| $sendmailer -t") || die "sendmailer: $!"; print MAIL "To: $emailto\n"; print MAIL "From: $emailfrom\n"; print MAIL "Subject: Response from owner\n"; print MAIL "\n"; print MAIL "You have a response: $id_in.
\n"; print MAIL "Please click the following link:
\n"; print MAIL "
\n"; print MAIL "$message

\n"; print MAIL "\n"; last; close(MAIL); close(MAIL); } }