Page 1 of 2

Generats a e-mail when something happend

Posted: Thu Nov 05, 2015 4:20 pm
by Quicken
I would like to send a mail when something happend in NetHome.
Example when temp goes low or high or maybe some movement or when a door bell button pushed.
I have config my RPI box so its possible to run command for send mail.
mail -s "Warning from NetHome" xxxxx@xxxxx.xx < message.txt

But how to run this command from NetHome server?
I look at "ValueTrigger" that maybe could use for response if in temp example.

Regards
Fred

Re: Generats a e-mail when something happend

Posted: Thu Nov 05, 2015 8:35 pm
by stefangsbb
A ValueTrigger would work fine. The way you specify an external script is to first select action "exec" and then press save. After that you can specify an external command or script as action, for example:

Code: Select all

exec,/usr/bin/mail -s "Warning from NetHome" xxxxx@xxxxx.xx < /usr/message.txt
The thing to watch out for is that OpenNetHome is running with a low privileged account, so you have to make sure it has the rights to run the command. You can see some more info in this post: http://nethomeserver.blogspot.se/2014/0 ... ation.html

Re: Generats a e-mail when something happend

Posted: Tue Nov 01, 2016 8:05 am
by TotalPE
Okay,is there anyone here that can help med and do an newbee guide how to fix the rights for the useraccount to alow it to send mail?

Thanx
/C

Re: Generats a e-mail when something happend

Posted: Sat Nov 05, 2016 3:41 pm
by rest
Hello!

I tried to send an email with the a command but when I add the command line my input is cleared and only "exec,echo " is left. I would like to run this: "echo "Crawl space to cold!" | mail -s "House Control" name@domain.com". What am I doing wrong?

/Reik

Re: Generats a e-mail when something happend

Posted: Thu Nov 10, 2016 5:54 am
by rest
Hello again!

Now I managed to not get an error in ONH but the mail is not sent anyway. I cant find anything in any log file. My command look like this:

ssmtp -t < /etc/opt/nethome/DoorBell.txt

If I use it with brackets [ssmtp -t < /etc/opt/nethome/DoorBell.txt] it will generate an error. It works nice from the commandline. Any idea anyone? Where can I find information about what is going wrong? In the mail logs is nothing...

/Reik

Re: Generats a e-mail when something happend

Posted: Wed Nov 16, 2016 9:03 pm
by rest
Hello again!

Is nobody using mail instead of jabber? Which user rights do I need to assign to nethome to be able to send mails?

/Reik

Re: Generats a e-mail when something happend

Posted: Mon Nov 28, 2016 9:39 pm
by rest
Hi room!

Now I have been struggling with sending mail for a while. I can't find anything in any log. If the command is not correct I get an error but when I use the correct syntax (works with putty logged in as pi) nothing happens. No error no mail... Does anybody have suggestion where to look?

/Reik

Re: Generats a e-mail when something happend

Posted: Tue Nov 29, 2016 3:54 pm
by rest
Another question...

If I would try to login as nethome with putty to test the mail sending. What is is the password of the nethome user?

/Reik

Re: Generats a e-mail when something happend

Posted: Sat Dec 03, 2016 10:41 am
by stefangsbb
The nethome user does not have a password, since it is not really intended for a human user. You can switch to the account using the "su" command like this:

Code: Select all

sudo su nethome
Then you will be acting as the nethome user. To go back to the original user you just type:

Code: Select all

exit

Re: Generats a e-mail when something happend

Posted: Sun Dec 04, 2016 12:51 pm
by rest
Thanks Stefan!

I'm not a linux specialist as you see :-). Sending mail as nethome user works fine. How ever, I still don't get any mail from the server. Do you have any suggestion?

/Reik