Sendmail

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Hello...
Me again Laughing out loud
Just trying to figure out how to get sendmail to work...
From the command line, I typed whereis sendmail
it came up with a lot of things, but the only one that ended in sendmail not sendmail.* was /usr/sbin/sendmail
I am trying to use a perl/cgi script that uses sendmail, but it won't send the mail.
No errors are recorded, but the mail is not sent.
I noticed that it takes quite a while for the script to execute if it is trying to use sendmail, but the other functions take no time at all.
Confused
Please help!
Thanks!
PS: Perl works fine and so does PHP, but MySQL just won't work yet...

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Everything that you always wanted to know about setting up RedHat sendmail.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

But sendmail is set up.
I set it up when I installed RH 6.2
It just won't work!
I set up Pine and I can receive/send mail from there...
ideas?

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

If sendmail is setup properly, then I would check the path to sendmail in your script. In RedHat, the path is usually /usr/sbin/sendmail. In other Linux distros the path is often /usr/bin/sendmail.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Nope.
When I submit the form that uses sendmail, it takes a long time to send, and I get a mail message in linux saying data format error.
I'll try again...

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Sorry, Nike_guy, I haven't been able to help you more. A new week old baby in the house makes it hard to type sometimes.

Is this a script that you wrote or one that you got off of the web?
If you want, you could email me the script or if it is not too long, post it here (using the code tag). I will try to look at it and test it to see if it is the script or your sendmail setup. A format error I would think would most likely be in the script.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

here we go:

#!/usr/bin/perl
print "Content-type:text/html\n\n";
$mail = 1;
if ($mail) {
open (MAIL,"/usr/sbin/sendmail");
print MAIL "To: parrabal\@home.com";
print MAIL "From: parrabal\@home.com";
print MAIL "Subject: Hello";
print MAIL "hello";
close(MAIL);
print "<html><head><title>yes</title></head></html>";
print "Hello";
} else {
print "Nope";
}
'
i've also tried
#!/usr/bin/perl
print "Content-type:text/html\n\n";
$mail = 1;
if ($mail) {
open (MAIL,"|/usr/bin/sendmail");
print MAIL "To: parrabal\@home.com";
print MAIL "From: parrabal\@home.com";
print MAIL "Subject: Hello";
print MAIL " hey hey hello";
close(MAIL);
print "<html><head><title>yes</title></head></html>";
print "Hello";
} else {
print "Nope";
}
'
but neither works

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Try using something like this:

$mailprog = '/usr/sbin/sendmail';

instead of

open (MAIL,"/usr/sbin/sendmail");

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Nope... doesn't fix it
Should the permissions for /usr/sbin/sendmail be changed??

They have: 105 posts

Joined: Jun 2001

It should be set to executable. Maybe it isn't correctly installed.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

It was installed when I installed RedHat 6.2
Should I try to chmod it?
What should I chmod it to?

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

chmod -777 will give everyone all priviledges.

I tried running it on my system. It didn't work. I will play around with it some today as time permits.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

How about using an SMTP server?
What is the difference and how would I use that instead??

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.