A
A
Anatoly Tarasenko2015-03-28 12:28:04
linux
Anatoly Tarasenko, 2015-03-28 12:28:04

Why do emails sent via cron come as attachments?

Here's a script:

#!/bin/bash
echo "$(df -h) \n $(tail /var/log/php.mail.log) \n $(exim -bpc)" | mail -s "at02.ru server" [email protected]

Lies in the root folder.
Such text in /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
*/60   *  *  *  * root /root/mail-about-space.sh

For some reason, emails sent via cron come as attachments.
8ef47937d4d84bd58a80de56fa91fe0d.jpg
If you run the file itself directly - the letter comes as it should in the text of the letter.
ca2b25cf460e4d45953584f56dae020a.jpg
The system is like this:
uname -a
Linux at02.ru 2.6.32-042stab102.9 #1 SMP Fri Dec 19 20:34:40 MSK 2014 i686 i686 i386 GNU/Linux

How to make letters come in text, not a file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2015-03-28
@Anatolt

And you look at them through "show original". Surely when the script is run from cron you receive Russian letters or something else non-ASCII, so mail sets them
Content-Type: application/octet-stream
Content-Transfer-Encoding: 8bit
What to do? -- set the language in the default environment, or explicitly do some kind of export LANG=C in the process of running the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question