mail script problem using cgi


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers mail script problem using cgi
# 1  
Old 03-08-2006
mail script problem using cgi

dear all

i've try several scripts and i think this is the simplest scripts that i can understand. please see below:-


if ($num >= 4000000001) {

#use CGI;

#my $query = new CGI;
#my $sendmail = "/usr/sbin/sendmail -t";
#my $reply_to = "bla@bla.com";
#my $subject = "Subject: Confirmation of your submission";
#my $content = "Thanks for your submission.";
#my $to = "a.b@c.com";==> OR <== #$query->param('a.b@c.com');
#my $file = "subscribers.txt";

#unless ($to) {
# print $query->header;
#print "Please fill in your email and try again";
#}

#open (FILE, ">>$file") or die "Cannot open $file: $!";
#print $to,"\n";
#close(FILE);

#my $send_to = "To: ".$query->param('a.b@c.com');

# open(MAIL, "|/usr/lib/sendmail -t");
# print MAIL "To: $to\n";
#print MAIL "From: $reply_to\n";
#print MAIL "Subject: $subject\n";
#print MAIL "This is the message body.\n";
#print MAIL "Put your message here in the body.\n";
#close (MAIL);

#print $query->header;
#print "Confirmation of your submission will be emailed to you.";

}

Unfortunately, i wont worked and no email received by me. Hope can learn from u guys.

Regards
unknown2205
# 2  
Old 03-08-2006
Probably the best is to look into the documentation that comes with the script for pointers. Failure to send mail may have many causes:

1) The script has bugs, or does not suit the deployment environment (incompatible interpreter versions/incompatible library versions etc.)
2) Improper modification of the script
3) Server blocking outgoing mail, or mail server failure
4) Destination account reject mail, or does not deliver mail
5) Intermediate mail servers reject or even drop mail, or improper configuration cause mail loops that eventually the mail is dropped
........ more

For Perl, you should normally not use "" to surround anything that contains @, $, %. For email address

"me@host.com"

may not be this string. Should use instead

'me@host.com'

Note single quotes used instead of double quotes unless you know Perl's way of escaping special chars. Also I feel uneasy to see this:

#my $send_to = "To: ".$query->param('a.b@c.com');

The stuff inside param() is the form field name. I don't think anybody would use 'a.b@c.com' as a field name so you are 99% mistaken here. I believe the script documentation should tell you how to modify the script. If not, probably you should try another script then.

Maybe IF you have access to the shell, then try to run sendmail from the command line and see if it works first? Otherwise you may need to consult the server administrator that this is working before you spend more hours trying to dig through it.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

2. Shell Programming and Scripting

Send mail using perl cgi

hi everyone , i want to send e-mail using Perl CGI. i am new to Perl please tell me the solution. I dont have any idea about sending mail through Perl : Please can you give me appropriate code for sending the mail Please help me out....??? (1 Reply)
Discussion started by: Navrattan Bansa
1 Replies

3. Shell Programming and Scripting

CGI shell script curl reponse problem

Hi, I am running a bash shell script for some simple web server CGI, the script runs as expected from the browser except the following: curl --silent --max-time 10 --output /dev/null --write-out %{http_code} http://server:port/filename This line outputs 404 when i execute the script... (0 Replies)
Discussion started by: Moxy
0 Replies

4. UNIX for Dummies Questions & Answers

Problem with CGI Script

Hello, I had to move our company's intranet to a new machine running Centos 5. Whenever cgi scripts now execute I find this error message in the logs: Mon Oct 05 11:19:39 2009] Premature end of script headers: vacation.cgi, referer: https:/{URL}] Could not find platform independent... (0 Replies)
Discussion started by: mojoman
0 Replies

5. UNIX Desktop Questions & Answers

CGI execution problem on Unix

Hello everyone, I have developed a cgi application on windows. i have created a folder in webapps of tomcat, within that a WEB-INF folder and in that cgi folder. This cgi folder contains one executable. The web.xml is as follows: <servlet> <servlet-name>cgi</servlet-name> ... (2 Replies)
Discussion started by: Preeti_t
2 Replies

6. Shell Programming and Scripting

problem for CGI create Cookie!!!!

Hi Everyone, I am facing the problem to create the cookie in CGI (bash script). Is it possible can create in cgi? or javascript better? Anyone got the sample to create the cookie in cgi(bash script)? Just the login will do ->> USERNAME and PASSWORD after create how to store into the... (2 Replies)
Discussion started by: ryanW
2 Replies

7. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies

8. Shell Programming and Scripting

CGI problem

1. I need CGI in my own server. plz tell me how do it ? 2. U know somethink FREE servers with CGI ? thanks cYa (2 Replies)
Discussion started by: kezzol
2 Replies

9. Shell Programming and Scripting

CGI passing arrays/hashes to another CGI script

If I have a Perl CGI script (script01), which fills an array(s) with information and outputs a HTML page with a link to another CGI page (script02); is there anyway to pass the array(s) from "script01" to "script02" when the page visitor clicks the link? Hope that makes sense! :) (2 Replies)
Discussion started by: WIntellect
2 Replies

10. Shell Programming and Scripting

bourne mail script problem

Hey there, Just have a quick question. i've written a program and it needs to send a email to confirm it's completed. now i've done the mail -s "Subject" test@test.com the problem is the program, when run just waits. it doesn't execute the next command unless i press ^D. is there away... (6 Replies)
Discussion started by: Priest_Ridden
6 Replies
Login or Register to Ask a Question