HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: gustavoringler on May 25, 2014, 03:27:16 AM

Title: BEGINNER - Help with sending email from HG
Post by: gustavoringler on May 25, 2014, 03:27:16 AM
Hi guys,
I am a beginner with HG...and so far I am pleasantly surprised with its capabilities.

Could somebody help me to understand what needs to be done in order to have HG send an email, triggered by an event in a scene ?

I would assume that an SMTP email account needs to be set in the "Email Account" program... (would Hotmail work ?)

But after doing this... what is the program instruction that has to be used to be able to send an email ?

Any help is welcomed !
Thanks !
Gus
Title: Re: BEGINNER - Help with sending email from HG
Post by: mvdarend on May 25, 2014, 09:15:03 AM

Quote
I would assume that an SMTP email account needs to be set in the "Email Account" program... (would Hotmail work ?)

Correct, I haven't got a Hotmail account though, so I don't know if it will work. (But I assume it will)


Here's a code snippet in C#:
Code: [Select]
Net.SendMessage("[email protected]", "Subject here", "This is the message text." );
Title: Re: BEGINNER - Help with sending email from HG
Post by: gustavoringler on May 26, 2014, 01:23:45 AM
Thanks mvdarend for your reply!

I would have to say that a C# snippet is way above my current skills...  :-[

What would be the program instruction (in a scene program) needed to invoke the email account program, to then get the email sent? (something like Automation-Email account - etcetera)

Thanks!
Title: Re: BEGINNER - Help with sending email from HG
Post by: kevin1 on September 02, 2014, 01:32:49 PM
It would be nice if HG could have a "test email" button on the email server configuration so we could rule out other issues and confirm the HG email setup is working.  Please :)
Title: Re: BEGINNER - Help with sending email from HG
Post by: bkenobi on September 02, 2014, 05:16:32 PM
You can make a test script with one line that will accomplish this.  Look at reference for "SendMessage".
Title: Re: BEGINNER - Help with sending email from HG
Post by: kevin1 on September 02, 2014, 08:59:00 PM
I tried that but still haven't gotten any messages, so I guess it is my Yahoo SMTP server settings, but not sure.  Thanks.
Title: Re: BEGINNER - Help with sending email from HG
Post by: bkenobi on September 02, 2014, 11:02:39 PM
Yahoo doesn't work.  I've posted an issue on github so hopefully Gene will get it fixed at some point.  The issue keeps any Implicit SSL SMTP server from working (Yahoo, Gmail, lots of others).
Title: Re: BEGINNER - Help with sending email from HG
Post by: ahafner on September 05, 2014, 12:52:10 AM
I was actually able to get email notifications to work with HG last night.  The only thing I did differently was to use port 587 instead of 25 or 465.  I also made sure that the 'Use SSL' setting was set to TRUE.  Once I changed that it seemed to work like a charm.  Hopefully that works for others as well.
Title: Re: BEGINNER - Help with sending email from HG
Post by: bkenobi on September 05, 2014, 04:49:50 PM
Is that for Yahoo or gmail?  I've tried everything I could think of, so it would be great if it did work just that easy!  Screen shot of settings?
Title: Re: BEGINNER - Help with sending email from HG
Post by: bkenobi on September 05, 2014, 07:07:59 PM
For yahoo, I'm using the following without success:

Code: [Select]
1. E-Mail address
<email>@yahoo.com
2. SMTP Mail Server address
smtp.mail.yahoo.com
3. SMTP username (optional)
<email>@yahoo.com
4. SMTP password (optional)
<account password>
5. SMTP Mail Server port
587
6. SMTP Mail Server use SSL (TRUE or FALSE)
TRUE

I'm running on a Raspi with r411.  Any thoughts on what you are doing differently?
Title: Re: BEGINNER - Help with sending email from HG
Post by: kevin1 on September 05, 2014, 07:58:34 PM
ahafner: I thought I posted earlier, Thanks!  This worked for me using Yahoo.

bkenobi:  the only difference I have from you is to remove the "@yahoo.com" from username
Title: Re: BEGINNER - Help with sending email from HG
Post by: bkenobi on September 06, 2014, 04:43:38 AM
I tried again without the domain and it worked.  I thought I tried that before, but it's working now so I'm happy!
Title: Re: BEGINNER - Help with sending email from HG
Post by: gustavoringler on October 23, 2014, 12:50:00 AM
Again, I kindly ask for help... :-)

What is the command (in a program instruction, not in a C# command...which is way beyond my knowledge) that will trigger sending the email ?

Just to clarify further... if, for example, I want to turn on a light that is associated with an X10 switch, in address C10, the program instruction in the "wizard script" would then be :

X10  C10  Light ON

What would be the program instruction to send an email ?
Thanks in advance !



Title: Re: BEGINNER - Help with sending email from HG
Post by: bkenobi on October 23, 2014, 04:12:54 AM
First, set up email via:
Messaging and Social -> E-Mail Account

Next, you MUST use a C# code to send the command.  You could probably write a C#/Java/Python/etc code that could make it possible to use the Wizard, but it's not currently set up that way.  Use the following code as the program code:

Code: [Select]
var subject = "test email";
var messagetext = "X10  C10  Light ON";
var recipients = "[email protected]";
Net.SendMessage( recipients, subject, messagetext );

Add the following for your trigger:
Code: [Select]
if (Modules.WithAddress("C10").IsOn)
{
  return true;
}
else
{
  return false;
}

Just modify the email info and compile and done!
Title: Re: BEGINNER - Help with sending email from HG
Post by: kevin1 on October 23, 2014, 04:07:16 PM
I was actually able to get email notifications to work with HG last night.  The only thing I did differently was to use port 587 instead of 25 or 465.  I also made sure that the 'Use SSL' setting was set to TRUE.  Once I changed that it seemed to work like a charm.  Hopefully that works for others as well.

Just wanted to highlight a post earlier in this thread... that using port 587 helped a couple of us using yahoo/gmail.
Title: Re: BEGINNER - Help with sending email from HG
Post by: petediscrete on September 15, 2015, 11:40:34 PM
I know it's been a while since this topic was started but I tried nearly every suggestion possible in previous posts and still can't HG to send me an email.

I'm using an RPI with the latest HG release as of 14th September 2015. I've tried installing Mono to deal with possible SSL issues on Gmail but as of yet still no success. I've tried all possible ports, I've dropped the @gmail.com on the username option and SSL=TRUE but still no success.

Does anyone have a working Gmail on HG and if so could you possibly post exactly what you did to achieve this, including settings and any other adjustments you had to make to achieve this. I've spent so much time on this with very little success. I do have another Debian based program running on the RPI, MotionPie, a video based security system which sends email alerts so I know that this function works on the RPI.