more G-Labs products

Author Topic: BEGINNER - Help with sending email from HG  (Read 5896 times)

May 25, 2014, 03:27:16 AM
Read 5896 times

gustavoringler

  • *
  • Information
  • Newbie
  • Posts: 8
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

May 25, 2014, 09:15:03 AM
Reply #1

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431

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." );

May 26, 2014, 01:23:45 AM
Reply #2

gustavoringler

  • *
  • Information
  • Newbie
  • Posts: 8
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!

September 02, 2014, 01:32:49 PM
Reply #3

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
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 :)

September 02, 2014, 05:16:32 PM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
You can make a test script with one line that will accomplish this.  Look at reference for "SendMessage".

September 02, 2014, 08:59:00 PM
Reply #5

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
I tried that but still haven't gotten any messages, so I guess it is my Yahoo SMTP server settings, but not sure.  Thanks.

September 02, 2014, 11:02:39 PM
Reply #6

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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).

September 05, 2014, 12:52:10 AM
Reply #7

ahafner

  • *
  • Information
  • Newbie
  • Posts: 1
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.

September 05, 2014, 04:49:50 PM
Reply #8

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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?

September 05, 2014, 07:07:59 PM
Reply #9

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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?
« Last Edit: September 05, 2014, 07:10:55 PM by bkenobi »

September 05, 2014, 07:58:34 PM
Reply #10

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
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

September 06, 2014, 04:43:38 AM
Reply #11

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I tried again without the domain and it worked.  I thought I tried that before, but it's working now so I'm happy!

October 23, 2014, 12:50:00 AM
Reply #12

gustavoringler

  • *
  • Information
  • Newbie
  • Posts: 8
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 !




October 23, 2014, 04:12:54 AM
Reply #13

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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!

October 23, 2014, 04:07:16 PM
Reply #14

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
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.