?
Solved

NEED HELP PLEASE !!

Posted on 2001-06-11
9
Medium Priority
?
233 Views
Last Modified: 2013-12-25
Dear xperts,
I have this script for form processing which is suppose to send me the data from a form, send a reply to the customer, add their e-mail address to a text file so that I can use it for my mailing list (After it has checked that the e-mail is not allready in the text file). Anyway the problem is that it does not add e-mail addresses to the text file and only sends the auto responder e-mail and not the e-mail which is intended for myself. I have included the script below so you can have a look of what I am doing wrong. Any help would be apreciated. Remember I am not an expert on CGI scripts !!

#!/usr/local/bin/perl

$|++;
use CGI;
$query = new CGI;

$fullname=$query->param('fullname');
$email=$query->param('email');
$problem=$query->param('problem');

open(MAIL, "|/var/qmail/bin/qmail-inject");
print MAIL "From: $fullname<$e-mail>\n";
print MAIL "To: krooga\@runbox.com\n";
print MAIL "Subject: Customer needs help !!!\n";
print MAIL "\n";
print MAIL "Full Name    : $fullname\n";
print MAIL "eMail        : $email\n";
print MAIL "Problem      : $problem\n";
close MAIL;

open(MAIL,"|/var/qmail/bin/qmail-inject");
print MAIL "To: $email\n";
print MAIL "From: support\@krooga.co.uk\n";
print MAIL "Subject: RE: Krooga support\n";
print MAIL "Thank-you for contacting us at krooga.co.uk,\n";
print MAIL "we have received your Question/Comment and\n\n";
print MAIL "we are working hard to respond to you as fast\n";
print MAIL "as possible. You should receive an answer from\n";
print MAIL "us very soon.\n\n";
print MAIL "Thanks again,\n\n";
print MAIL "The Krooga Suport Team\n";
print MAIL "http://www.krooga.co.uk\n\n";
close MAIL;


open (LIST, ">>/data1/hypermart.net/krooga/support/maillist.txt");
@lines = <LIST>;
foreach $line (@lines)
{
$foundacopy = 0;
foreach $line2 (@lines)
{
if($line2 eq $line)
{
$foundacopy = 1;
}
}
if($foundacopy==0)
{ # prints only if no copy has been found
print LIST "$email\n";
}
}
close (LIST);

print "Content-type: text/html\n\n";
open(HANDLE,"/data1/hypermart.net/krooga/support/thanks.htm") || print "could not open thanks";
while(<HANDLE>) {
  $_=~s/grfx/..\/grfx/g;
  print $_;
}


Thanx
Sam ;-)

0
Comment
Question by:samgonzales
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 5

Expert Comment

by:marecs
ID: 6180154
Put
use CGI::Carp 'fatalsToBrowser';  # Remove when script works 100%
after
use CGI;

open (LIST, "+>>/data1/hypermart.net/krooga/support/maillist.txt") || die $!;
@lines = <LIST>;
chomp @lines;
print LIST "$email\n" unless grep {$e-mail eq $_} @lines;
close (LIST);

print MAIL "From: $fullname<$email>\n"; and not e-mail

There should be a
print MAIL "\n";
after the Subject for the second email. I don't know why you are not receiving the email sent to yourself.

Put the || die $! after each open
0
 

Expert Comment

by:Wazza
ID: 6180183
i think i have missed something here - but aren't u comparing the same array against itself???

@lines = <LIST>;
foreach $line (@lines) ####### here
{
$foundacopy = 0;
foreach $line2 (@lines) ####### here
{
if($line2 eq $line)
{
$foundacopy = 1;
}
}
if($foundacopy==0)
{ # prints only if no copy has been found
print LIST "$email\n";
}
}
close (LIST);
0
 

Author Comment

by:samgonzales
ID: 6182712
Do you think you could repost the complete script because i don't really understand what to do here. I am a newbie to CGI and perl I only install them.

Thanks

Sam ;-)
0
Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

 
LVL 3

Expert Comment

by:rag2000
ID: 6191006
#!/usr/local/bin/perl

$|++;
use CGI;
$query = new CGI;

$fullname=$query->param('fullname');
$email=$query->param('email');
$problem=$query->param('problem');

open(MAIL, "|/var/qmail/bin/qmail-inject");
print MAIL "From: $fullname<$email>\n";
print MAIL "To: krooga\@runbox.com\n";
print MAIL "Subject: Customer needs help !!!\n";
print MAIL "\n";
print MAIL "Full Name    : $fullname\n";
print MAIL "eMail        : $email\n";
print MAIL "Problem      : $problem\n";
close MAIL;

open(MAIL,"|/var/qmail/bin/qmail-inject");
print MAIL "To: $email\n";
print MAIL "From: support\@krooga.co.uk\n";
print MAIL "Subject: RE: Krooga support\n";
print MAIL "\n";
print MAIL "Thank-you for contacting us at krooga.co.uk,\n";
print MAIL "we have received your Question/Comment and\n\n";
print MAIL "we are working hard to respond to you as fast\n";
print MAIL "as possible. You should receive an answer from\n";
print MAIL "us very soon.\n\n";
print MAIL "Thanks again,\n\n";
print MAIL "The Krooga Suport Team\n";
print MAIL "http://www.krooga.co.uk\n\n";
close MAIL;

open (LIST, "+>>/data1/hypermart.net/krooga/support/maillist.txt");
@lines = <LIST>;
foreach $line (@lines)
{
$foundacopy = 0;
foreach $line2 (@lines)
{
if($line2 eq $line)
{
$foundacopy = 1;
}
}
if($foundacopy==0)
{ # prints only if no copy has been found
print LIST "$email\n";
}
}
close (LIST);

print "Content-type: text/html\n\n";
open(HANDLE,"/data1/hypermart.net/krooga/support/thanks.htm") || print "could not open thanks";
while(<HANDLE>) {
 $_=~s/grfx/..\/grfx/g;
 print $_;
}
0
 
LVL 3

Expert Comment

by:rag2000
ID: 6191028
change open(MAIL, "|/var/qmail/bin/qmail-inject");
to open(MAIL, "|/var/qmail/bin/qmail-inject -t");
0
 
LVL 5

Accepted Solution

by:
marecs earned 450 total points
ID: 6191080
#!/usr/local/bin/perl
$|++;
use CGI;
use CGI::Carp 'fatalsToBrowser';  # Remove when script works 100%

$query = new CGI;
$fullname=$query->param('fullname');
$email=$query->param('email');
$problem=$query->param('problem');
open(MAIL, "|/var/qmail/bin/qmail-inject") || die $!;
print MAIL "From: $fullname<$email>\n";
print MAIL "To: krooga\@runbox.com\n";
print MAIL "Subject: Customer needs help !!!\n";
print MAIL "\n";
print MAIL "Full Name    : $fullname\n";
print MAIL "eMail        : $email\n";
print MAIL "Problem      : $problem\n";
close (MAIL) || die $!;

open(MAIL,"|/var/qmail/bin/qmail-inject") || die $!;
print MAIL "To: $email\n";
print MAIL "From: support\@krooga.co.uk\n";
print MAIL "Subject: RE: Krooga support\n";
print MAIL "\n";
print MAIL "Thank-you for contacting us at krooga.co.uk,\n";
print MAIL "we have received your Question/Comment and\n\n";
print MAIL "we are working hard to respond to you as fast\n";
print MAIL "as possible. You should receive an answer from\n";
print MAIL "us very soon.\n\n";
print MAIL "Thanks again,\n\n";
print MAIL "The Krooga Suport Team\n";
print MAIL "http://www.krooga.co.uk\n\n";
close (MAIL) || die $!;

open (LIST, "+>>/data1/hypermart.net/krooga/support/maillist.txt") || die $!;

@lines = <LIST>;
chomp @lines;
print LIST "$email\n" unless grep {$email eq $_} @lines;
close (LIST) || die $!;

print "Content-type: text/html\n\n";
open(HANDLE,"/data1/hypermart.net/krooga/support/thanks.htm") || die $!;
while(<HANDLE>) {
 s/grfx/..\/grfx/g;
 print;
}
0
 

Author Comment

by:samgonzales
ID: 6192527
This is giving me a giving me a headache i tried it but it doesn't seem to be working....I changed my pw for hypermart can u please log on into my account and get the script working !! The details r as follows :

Username - krooga
Password - thanks

http://krooga.hypermart.net/support/maillist.txt
http://krooga.hypermart.net/cgi-bin/easyform.cgi
http://krooga.hypermart.net/contactus.htm

Thanks

Sam ;-)
0
 
LVL 5

Expert Comment

by:marecs
ID: 6192775
I'll have a look
0
 
LVL 5

Expert Comment

by:marecs
ID: 6192941
Try it now.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question