[SOLVED] Does anyone know how email from bash script?

I have to write a bash script to check the files and log for changes to scheduled backups the night before and email them to an IT Administrator

But I am having a problem sending an email from the NAS via bash script.
This is what I have tried without success

Via send_gen_mail

$ /usr/sbin/send_gen_mail -m "Hello World" -s "Test" -r "myemail@address"

The server responds with nothing. did it work? I don’t know. there is nothing in the logs either.

Via Mutt

$ mutt -s "Test Email" myemail@address
Error opening terminal: xterm-256color.

Via Rest-API?

I have no clue how to source that

Perhaps I have to install the ubuntu image via docker to get something working. I have the EX4100 series so I need to get the arm7 version


# docker pull armv7/armhf-ubuntu:14.04
14.04: Pulling from armv7/armhf-ubuntu
c11f1521cacf: Pull complete 
0b7eccc41093: Pull complete 
cb9e07433459: Pull complete 
b89aa9566aaf: Pull complete 
6f21efd1e2a9: Already exists 
Digest: sha256:fd9eeb78c32556a8139e1c803518d01561193774f7af66060c6a4deb096582dc
Status: Downloaded newer image for armv7/armhf-ubuntu:14.04

# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu               14.04               35b394a6f7a2        3 days ago          187.9 MB
hello-world          latest              f0cb9bdcaa69        3 months ago        1.848 kB
armv7/armhf-ubuntu   14.04               6f21efd1e2a9        19 months ago       238.8 MB

Now what? All I need to do is send an email within a Bash script.

Is this any help? http://stackoverflow.com/questions/5155923/sending-a-mail-from-a-linux-shell-script

No. I cant install Mail. Right now im going to try and use perl. Ill let you know how it goes

Installing sendemail perl modules also can’t work cause I would need to install NET::SSLeay, which needs to be built with a c compiler.
Therefore I can’t install sendemail for my emailing needs

On to another way…

Can’t make a php script within the /var/www/pages dir cause its a squashfs file system to prevent wiring (read-only fs).

now trying to make my own php mailer in /home/root…


Used PHPmailer

Put the following files in /home/root/


Im using gmail to send out the emails. so for this reason I used the gmail.phps found in the PHPMailer -> Examples Directory

Now i just need to write the bash script! :slight_smile:

The only problem is that once the system reboots… all the files in /home/root were cleared

I used Alexey’s solution by Installing Transmission and editing the init.sh script to modify the crontab and run my scripts