LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices



Reply
 
Search this Thread
Old 04-11-2012, 07:09 PM   #1
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Rep: Reputation: Disabled
Receiving sh: usr/sbin/sendmail: not found message when trying to send mail


I am using ubuntu 10.04.2 and had installed postfix on it last week and managed to get it sending emails using a php script activated by a game we are working on. The email stopped working yesterday. I can send email through the console but I am receiving the following message every time I send it using the php script sh: usr/sbin/sendmail: not found. I installed mailq today as was suggested in a postfix forum but that didn't fix it either. I have gone through about 100 different posts today and nothing has helped. Hoping someone has some ideas
 
Old 04-11-2012, 08:03 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,132

Rep: Reputation: Disabled
Quote:
Originally Posted by oldFlurp View Post
I am using ubuntu 10.04.2 and had installed postfix on it last week I can send email through the console but I am receiving the following message every time I send it using the php script sh: usr/sbin/sendmail: not found.
Is that the exact error message you're getting? usr/bin/sendmail is a relative path, and should probably be /usr/sbin/sendmail (or whatever which sendmail returns as the location of the sendmail binary/link).
 
Old 04-11-2012, 08:05 PM   #3
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Yes, I copied and pasted it into the thread.
 
Old 04-11-2012, 08:26 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,132

Rep: Reputation: Disabled
Then you should find the reference in your php script and change it from a relative to an absolute path.
 
Old 04-11-2012, 08:32 PM   #5
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
The php script I am using to send mail wouldn't be the issue. I have included it. I checked the path in /etc/php5/apache2/php.ini and found it was /usr/sbin/sendmail and found the same in /usr/lib/postfix/main.cf. Any ideas where else I should check?

<?php
require_once "Mail.php";

// Pick up the form data and assign it to variables
$object = $_POST['VersionNumber'];
$text= $_POST['MessageBody'];
$email = $_POST['UserID'];

$to='placeholder@placeholder.com';
$subject="$object";
$message="text: $text";
$headers = "From: $email";

// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);
?>
 
Old 04-11-2012, 09:07 PM   #6
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,132

Rep: Reputation: Disabled
The exact error message, sh: usr/sbin/sendmail: not found, seems to suggest a shell script of some sort. I did a quick test and found that ash is the only shell generating that exact message. The error messages from bash, csh, zsh and ksh are all different in one way or another.

Does this error appear on a php-generated error page? Or did you find it in a log file?
 
Old 04-11-2012, 09:15 PM   #7
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
It is located in /var/log/apache2/error.log
 
Old 04-11-2012, 09:39 PM   #8
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Dehradun, Uttarakhand, India
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,413

Rep: Reputation: 303Reputation: 303Reputation: 303Reputation: 303
Make sure that sendmail is installed.

Code:
# dpkg -s sendmail
Or

Code:
# dpkg --list | grep -i sendmail
 
Old 04-11-2012, 09:44 PM   #9
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,132

Rep: Reputation: Disabled
This has to be somehow related to the php mail() function.

You say that it stopped working yesterday. Did you upgrade or change anything (php, apache, postfix) just prior to that?

What does which sendmail and locate php.ini return?
 
Old 04-11-2012, 10:26 PM   #10
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
which sendmail returned /usr/sbin/sendmail and locate php.ini returned several including /etc/php5/apache2/php.ini (the one I have been checking which has the sendmail path set to /usr/sbin/sendmail in it), /etc/php5/cli/php.ini (the sendmail path is commented out), and then others that aren't the true php.ini file (php.ini-production and others, none of which had paths set for sendmail)
 
Old 04-12-2012, 04:55 AM   #11
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,132

Rep: Reputation: Disabled
Anything else in the Apache error.log that could tell us how sendmail is called?

What are the access rights on /usr/sbin/sendmail?
 
Old 04-12-2012, 11:52 AM   #12
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Every time I try to send an email I get that one line of error (sh: usr/sbin/sendmail: not found). When I typed in ls -l send mail shows -> /etc/alternatives/sendmail. When I tried to check that location it redirected me again, so I am not certain of the answer on the access rights.
 
Old 04-12-2012, 12:58 PM   #13
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,132

Rep: Reputation: Disabled
Quote:
Originally Posted by oldFlurp View Post
When I typed in ls -l send mail shows -> /etc/alternatives/sendmail. When I tried to check that location it redirected me again, so I am not certain of the answer on the access rights.
Where did that second link point? You need to track down the actual executable (or script) to view the access rights.

On some systems using an MTA other than sendmail, /usr/sbin/sendmail is a link to /etc/alternatives/<something> which again is a link to an executable or a script providing sendmail-like functionality to applications that require it. I think you're getting close.

BTW, what happens if you run /usr/sbin/sendmail from the command line?
 
Old 04-12-2012, 02:13 PM   #14
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
the permissions for sendmail are -rwxr-sr-x 1 root root smmap. It was the next step in the links. When I type in sendmail -v user@domainname.com ( a different email address than this) it hangs. I am able to send emails via telnet and by using the command echo testing | mail placeholder@placeholder.com
 
Old 04-12-2012, 02:51 PM   #15
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,132

Rep: Reputation: Disabled
The php mail() function is using sendmail, so unless the sendmail executable or script actually works, sending mails from a php script will fail.

The sendmail command expects you to provice it with the body of an e-mail from stdin. Try: echo This is a test message. | /usr/sbin/sendmail -v user@domainname.com
 
  


Reply


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
Using /usr/sbin/sendmail to deliver message to local SMTP server enmingteo Linux - Server 9 05-07-2009 11:55 AM
127 Can't execute command '/usr/sbin/sendmail kiganda Linux - Newbie 1 10-03-2007 06:50 AM
Sendmail/Outlook problem (receiving is ok but cannot send) custangro Linux - Server 1 07-17-2007 01:23 AM
How to start '/usr/sbin/sendmail' auto ... ? emil+ Slackware 2 02-18-2006 12:50 PM
what should /usr/sbin/sendmail be chmoded to? ShawnD Linux - General 3 08-23-2002 01:57 PM


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

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