"/usr/sbin/sendmail/" Not found

Locally a Rail app works well, but on a VPS server when I try to send an email with all the correct settings by the means of the Rails app, I get this error in the logs:

sh: 1: /usr/sbin/sendmail: not found

How to fix it?


Solution 1:

You need to install the sendmail package on your VPS as well as your local machine. Assuming you use some form of Debian linux, you want to run:

sudo apt-get install sendmail

on the VPS.

Solution 2:

You need to install a Mail Transport Agent (MTA).

First, let's install postfix, which provides a /usr/bin/sendmail:

apt-get update
apt-get install postfix

A configuration screen will pop up, where you need to enter some configuration values. This really depends on your setup. The standard installation is "Internet site", where mail will be sent directly from your server. You can also configure it to relay mail through an external mailserver, which may be preferable if you don't want to deal with SPF, TLS, reverse DNS, etc. But the specifics of the configuration is outside the scope of this question (just Google it, or post a new question if you get stuck).