My understanding is that:

  • sSMTP has to be installed and configured
  • MAILTO= has to be added on top of crontab

I have setup also installed the following instructions: https://wiki.archlinux.org/index.php/SSMTP

I've read other tutorials however they were from around 2009 and outdated.

Upon testing it as per the instructions I was not able to get it to work.

> echo test | mail -s "testing ssmtp setup" <email_address>
mail: cannot send message: Process exited with a non-zero status

The email address I am trying to send emails from is a @gmail.com address.

2 Answers 2


mail: cannot send message: Process exited with a non-zero status

  • Look in your logs.
  • Find out what the exit status is.
  • Investigate what it means.
  • Apply changes to rectify.
  • Which log specifically do I check? Commented Feb 19, 2017 at 6:43

First you should have an MTA installed on your system.

sudo apt-get install exim4

After that you should configure this MTA with smtp parameters (gmail in your case):

sudo dpkg-reconfigure exim4-config

Choose smarthost usage and set a correct smtp (gmail smtp server for you) address. To ensure you've correctly configured the smtp server check dc_smarthost parameter in /etc/exim4/update-exim4.conf.conf file.

If you have to provide password authentication for the smtp server, check this link content to do that.

If the smarthost configuration is correct the send command must work in a shell script:

echo "Mail Body" | mail -s "Suject" [email protected]

This is a basic way to send mail, to improve it: man mail

  • It would be useful to tell how to configure the package in CentOS since dpkg-reconfigure cannot be applied there. Commented Feb 17, 2022 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .