Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-09-2004, 05:25 AM   #1
LQ Newbie
Registered: Jun 2004
Posts: 4

Rep: Reputation: 0
Angry CGI Script runs to send mail, but mail is never sent

I have a a linux box that is being used as a web server.

The versions are Red Hat Linux release 7.2 (Enigma) Kernel 2.4.7-10 on an i686.

The problem I am having is a follows:

We use forms on our website to collect customers infor and enquires. When these forrms are submitted the call a CGI/PERL script that basically emails the details through using SENDMAIL and then send the user on to a THANK YOU page.

The forms submit, and the thank you page is displayed, but no email is sent!

I have tried manually sending mail using the commands in the script and mail is sent, well externally, but not to internal recipients.

Is there any way to see exactly what is happening such as a log or a way of modifing the script to give some sort of visual feedback to confirm the mail has been sent.

The script is as follows:


#load email addresses

open PTR,"../Data/emails.txt" or warn("Content-Type: text/html\n\nCould not open email address file");
close PTR;


use CGI;
# create new CGI object

# now get the details

open MAIL, "| sendmail -oi -t ";

print MAIL "From: <website\>\r\n";
print MAIL "To: <$emails[$destid]>\r\n";
print MAIL "Reply-to: <iain.furneaux\>\r\n";
print MAIL "Subject: Form submission from SIM web site\r\n";
print MAIL "\r\n";
print MAIL "

$title $firstname $initial $lastname has visited the SIM web site and requested more details about us or
a product/service that we offer. $title $lastname works for $company, the contact details for $title $lastname
are as follows: (Destid=$destid)

$title $firstname $initial $lastname

email: $email
Tel: $phone

if you want to find out a little more about this company then the web site address entered was $website.

$title $lastname also submited the following comments:


close MAIL;


print "Location: $rootRegistrationThankU.html\n\n";
print "Location: $root/ContactThankU.htm\n\n";
Old 06-09-2004, 07:14 AM   #2
Registered: Mar 2004
Location: Minnesota
Distribution: Fedora Core 1, Mandrake 10
Posts: 405

Rep: Reputation: 30
I believe you have to have some sort of mail server running on your machine. Like qmail or squirrel mail. I have never dealt with running a mail server (though I considered it once) so I cannot help you with them. Look into that though, that may be all you need to do.

If you get it working, please post how, I may just give it a whirl myself. May I use that script you posted if I do?

Good luck,
Old 06-10-2004, 10:57 AM   #3
LQ Newbie
Registered: Jun 2004
Posts: 4

Original Poster
Rep: Reputation: 0
There is a mail server running on the machine, SENDMAIL which I think is part of, or an add on of Linux.

Mail does try and get sent but it is bounced straight back.

Anybody else have any ideas?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shel script mail send ("/" in mail address) problem anaid Linux - Networking 3 08-23-2005 08:41 AM
How do I send mail from inside a script? bruno buys Linux - Software 3 10-06-2004 08:57 PM
bash script to send mail Cruger Programming 1 03-06-2004 09:25 AM
howto send a mail with attachment via perl script ? cccc Programming 24 03-05-2004 08:49 PM
I'm looking for a simply perl script to send mail, when ping down cccc Programming 2 01-12-2004 05:36 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration