# PHP: sh: 1: /usr/sbin/sendmail: not found — mail() returns false

**Code:** `sendmail: not found (PHP mail)` · **Category:** Email / SMTP · **Seen on:** SMTP, PHP, Linux

PHP's `mail()` calls the `sendmail_path` program, but it is not installed or the path in php.ini is wrong.

## Meaning

`mail()` does not speak SMTP; it hands the message to a local binary (Sendmail, Postfix, msmtp). In Docker and minimal servers no such binary exists. Install a lightweight MTA such as msmtp or Postfix as a relay, set `sendmail_path`, or better: use PHPMailer/Symfony Mailer with real SMTP.

## Common causes

- No MTA installed (typical in Docker images)
- `sendmail_path` points to a missing binary
- Binary exists but lacks permissions
- Chrooted PHP-FPM without access to the binary
- Disabled `mail()` by the host

## Quick fix

1. Install `msmtp` or Postfix and point `sendmail_path` at it
2. Switch to SMTP via PHPMailer or Symfony Mailer
3. Check `phpinfo()` for the active `sendmail_path`

## Detailed fix by platform

### Linux

1. `which sendmail; php -r 'echo ini_get("sendmail_path");'` then `apt-get install -y msmtp-mta`

## Code examples

### php.ini with msmtp

```ini
sendmail_path = "/usr/bin/msmtp -t"
```

## How to diagnose

1. **Binary** — which sendmail finds it?
2. **Path** — sendmail_path value?
3. **Container** — Minimal image?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/email/php-sendmail-not-found)
