You need to install the Mail Transfer Agent (MTA).
First install postfix , which provides /usr/bin/sendmail :
apt-get update apt-get install postfix
A configuration screen will appear where you need to enter some configuration values. It really depends on your setup. The default setting is an “Internet site” where mail will be sent directly from your server. You can also configure it to relay mail through an external mail server, which may be preferable if you do not want to deal with SPF, TLS, reverse DNS, etc. But the specifics of the configuration are beyond the scope of this question (just google, or post a new question if you're stuck).
source share