Receiving sh: usr/sbin/sendmail: not found message when trying to send mail
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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).
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'];
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?
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)
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.
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?
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.