I've had a cronjob working for about a fortnight without any problems. Then last night I checked I didn't get the email that I usually get. I went to the terminal to try send myself an email, I got the following error:
mail: cannot send message: process exited with a non-zero status
I haven't changed anything with my ssmtp cfg file. It just stopped working, when I check and recheck everything, the code, ssmtp, everything is perfect.
I send out my emails twice a day via cronjob. The crontab hasn't been interfered either. I really don't know why it would stop working.
The system sends out emails via gmail - I've gone into the gmail account and sent out test emails, they are sent and received without any problems.
Additionally I've checked throughout google, forums, websites I don't see any mistakes. This makes sense as everything was working fine 24 hours ago, and now it's just stopped.
Q: Is there any way of diagnosing and troubleshooting how to solve such a problem?
9 Answers 9
I have get the same problem in an Ubuntu 14.04 server. And I find error message in /var/log/mail.err
, which said:
postfix/sendmail[27115]: fatal: open /etc/postfix/main.cf: No such file or directory
Then I just reconfigured postfix
and solved this problem.
sudo dpkg-reconfigure postfix
-
4Could you tell us what reconfig option you selected?Fernando– Fernando2015年09月06日 14:29:44 +00:00Commented Sep 6, 2015 at 14:29
-
2I selected server as "internet server" and domain as server domain all rest were first choice. This worked for me.Bartosz Dabrowski– Bartosz Dabrowski2016年08月16日 15:24:39 +00:00Commented Aug 16, 2016 at 15:24
-
2thanks for the hint:
/var/log/mail.err
- big help for newbiebkwdesign– bkwdesign2020年08月18日 03:43:50 +00:00Commented Aug 18, 2020 at 3:43
Its mainly due to file size is very large, You can zip the file and resend them..
On Debian I got the error
mail: cannot send message: process exited with a non-zero status error
and an exit code of
$ echo $?
$ 36
because the hostname in /etc/hostname and the name for 127.0.0.1 in /etc/hosts differed.
I don't know if it helps to anyone, but here is my experience. I configure ssmtp
just to send emails from my Ubuntu 18.04 server.
What cause me the error was that gmail had "less secure apps off", this caused that google couldn't authenticate my server's certificate. Once enabled, I could start sending emails from the server. Hope it helps!
-
Thing to note for all future viewers; Less Secure Apps will be blocked/disabled permanently from 15 feb 2021.Asitis– Asitis2021年02月03日 12:52:00 +00:00Commented Feb 3, 2021 at 12:52
sudo dpkg-reconfigure postfix
system mail name.
please read the log : vim /var/log/mail.err
ff@ubuntu:/var/log$ head -n 20 mail.err
Sep 7 10:36:39 ubuntu sm-msp-queue[6302]: unable to qualify my own domain name
(ubuntu) -- using short name
ff@ubuntu:/var/log$
-
3Can you spell this out a bit more? It starts with roaima’s answer but I don’t understand the next three words.2018年09月07日 10:05:50 +00:00Commented Sep 7, 2018 at 10:05
I had the same error. I was using a gmail account to send emails. After checking my gmail I notice Google was sending to me Critical security alerts via email. I had to give permissions to unsecure apps in my Google account security section to make it works.
I'm using Docker
and I have to implement the following in my Dockerfile
too:
RUN echo "localhost localhost.localdomain" >> /etc/hosts
What caused me the error was that gmail had "less secure apps" set as "off", this caused google to be unable to authenticate my server's certificate. Once enabled, I could start sending emails from the server.
Go to your google account and search for "less secure apps" turn it on and test again! Worked like a charm from then on...
Sorry this is so simple, but fought this error for hours and nothing worked. But a simple uninstall and reinstall did.
I copied out my config files for reference and ran WARNING - the purge will delete your config files
sudo apt purge postfix
https://askubuntu.com/a/1371568
It reinstalled and ran without issue
-
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.2023年03月23日 14:45:21 +00:00Commented Mar 23, 2023 at 14:45
The solution was on my Debian is run the mail command as root.
Login as root
sudo su
or send mail as root
echo "Test message" | sudo mail -s "Subject" [email protected]
-
3Your second command runs echo as root, it does not send mail as root. Regardless, running something as root isn't really a solution, it just shows that you have permission issues somewhere.Matthew Sharp– Matthew Sharp2020年12月15日 10:31:56 +00:00Commented Dec 15, 2020 at 10:31
/var/log
) 3) Have you checked that network ports used for mailing are not blocked on your Internet connection?/var/log/mail.log
I guess