1

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.

Darthtrader
  • 311
  • 1
  • 5
  • 12

2 Answers2

1

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.
user9517
  • 114,104
  • 20
  • 206
  • 289
1

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" foo.bar@domain.tld

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