Page 1 of 2

A more generic e-mail app!

Posted: 20 Mar 2016 12:20
by l11
It would be great if someone could make a messaging app for the razberry operative. I would love if there was a small sendmail server on the pi that could send mail to me on events. Same for sms but I realize that could be a cost issue. But maybe it could send to whatsapp and other message apps?
It's not only about controlling the house, we also need some better passive feedback from the house as well

what do you say? Good idea?

Re: A more generic e-mail app!

Posted: 28 Jul 2016 21:07
by PoltoS
This is a big challange. Since most of mails from Pi will end up in spam. We are designing a mailing service for this.

Re: A more generic e-mail app!

Posted: 12 Dec 2016 04:48
by icebrian
Why not have an app that would allow for the configuration of an SMTP server? One could for example simply configure a gmail account for outgoing e-mail, therefore avoiding spam filters.

Re: A more generic e-mail app!

Posted: 12 Dec 2016 12:05
by pz1
icebrian wrote:Why not have an app that would allow for the configuration of an SMTP server? One could for example simply configure a gmail account for outgoing e-mail, therefore avoiding spam filters.
Did you have a look at the Email app that has been added to the App-store again acouple of days ago:

Re: A more generic e-mail app!

Posted: 12 Dec 2016 20:35
by icebrian
I did indeed, and I am using it. Works great, however, it is using an SMTP server by z-wave.me and am concerned this won't be scalable as also e-mails are preformatted with content that does not belong to me, ergo my comment on having an app that would allow for the configuration of an SMTP server.

Is there may-be someway in which I can change the SMTP server for the "E-mail ME" app?

Re: A more generic e-mail app!

Posted: 12 Dec 2016 21:00
by pz1
If you look into the index.js file of the app, below "--- Module metrics" you find the present code. It is not just replacing a SMTP url I think.
I agree it would be nice to use your own SMTP.

Re: A more generic e-mail app!

Posted: 13 Dec 2016 01:20
by icebrian
Yeap found it. I actually changed "url: "https://service.z-wave.me/emailnotification/"," to point to a PHP of my own server that received POST's and sends an e-mail, however, it seems that changes that I make on index.js are ignored.

When testing, all emails where still being sent via z-wave.me mail servers. Might you know if there is some cache that might need cleaning so that changes are reflected?

Re: A more generic e-mail app!

Posted: 13 Dec 2016 12:36
by pz1
In principle it is neccessary to restart your z-way service (or reboot your pi). If you did that, I don't know why it is still using the same email service

Re: A more generic e-mail app!

Posted: 14 Dec 2016 01:25
by icebrian
Indeed that was it. I restarted and it worked. So for documentation purposes here is what I did:

Edited file /opt/z-way-server/automation/userModules/MailNotifier/index.js and changed line 106 from:

Code: Select all

url: "https://service.z-wave.me/emailnotification/",
To:

Code: Select all

url: "https://myserver.com/emailnotification/",
And then in my own server I have the following PHP (with mailserver correctly configured):

Code: Select all

<?php

$email_to = $_POST['mail_to'];
$email_from = "myemail@mydomain.com";

$email_subject = '[home@'.date("Ymd").'-'.date("H:i").'] '.$_POST['subject'];

$email_message = $_POST["message"]."\n\n".
'<p><i><font size="2">Event generated on '.date("Y-m-d").' at '.date("H:i").'</font></i></p>';

#// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion()."\r\n".
'Content-Type: text/html; charset=UTF-8';

@mail($email_to, $email_subject, $email_message, $headers);

?>
Now, as is, it is obviously a serious security risk, as it would allow anyone to send e-mail via my server, so I don't recommend using as is.

A quick fix could be hard codding the TO value with an e-mail, which could however result in an e-mail flood.

Re: A more generic e-mail app!

Posted: 15 Dec 2016 18:39
by enbemokel
Nice Link:

https://service.z-wave.me/emailnotification/

I have the feeling not to use this app or this service, as there are some logfiles in the service.z-wave.me server
that are open to public. Mailed this yesterday to the forum admin but no reaction. :-(