Hi, lot of solutions are there to fix this problem but I feel somewhere, sometimes we miss the basic part...
It may be possibility that we don't have sendemail utility itself not installed. Please install by running following command.
sudo apt-get install sendmail -y
If issue is still there please check following link:
Thanks!!!! Enjoy Programming :)