more G-Labs products

Author Topic: mail notification not received  (Read 6692 times)

November 16, 2014, 06:47:01 PM
Read 6692 times

kiwi799

  • *
  • Information
  • Newbie
  • Posts: 10
hello, I am struggling to make mail notification on my HG, but I did not succeeded for the moment. I follow this topic "http://www.homegenie.it/forum/index.php?topic=223.0", but it is not working for me.

I have HG r421 on Ubuntu server v14.
I setup my Email Account with Gmail or Yahoo.fr account but did not receive any mail
Code: [Select]
1. E-Mail address
<email>@gmail.com
2. SMTP Mail Server address
smtp.gmail.com
3. SMTP username (optional)
<email>@gmail.com
4. SMTP password (optional)
<account password>
5. SMTP Mail Server port
587
6. SMTP Mail Server use SSL (TRUE or FALSE)
TRUE

For my test, I create a C# program with below in program code
Code: [Select]
// CSharp Automation Program : send an email to test the mail settings
var subject = "test email";
var messagetext = "HG Test Email";
var recipients = "########@gmail.com";
Net.SendMessage( recipients, subject, messagetext );

Here is my trigger code:
Code: [Select]
if (Modules.InDomain("HomeAutomation.ZWave").WithAddress("5").IsOn)
{
  return true;
}
else
{
  return false;
}

When I switch on my "Zwave 5" light, I don't receive email.
So I installed an SMTP server on another computer, activated SMTP log on this server. Then send sucessfully an email by telnet. The SMTP session is logged in the SMTP server log.

I changed my Email account to use my lcoal SMTP server.
Code: [Select]
Email.Sender = "[email protected]"
Email.SmtpPassword = "password"
Email.SmtpPort = "25"
Email.SmtpServer = "192.168.77.82"
Email.SmtpUserName = "user1"
Email.SmtpUseSsl = "FALSE"
I changed my C# program with below in program code
Code: [Select]
// CSharp Automation Program : send an email to test the mail settings
var subject = "test email";
var messagetext = "HG Test Email";
var recipients = "[email protected]";
Net.SendMessage( recipients, subject, messagetext );
Now when I switch on my "Zwave 5" light, nothing is logged in the SMTP log. So this means that HG does not try to connect to my SMTP server 192.168.77.82.

I also added a module to my Zwave group so as there is a button which activate my program. When I click on it, it should send the email. But this also does not make my HG connect to my SMTP server.

Can someone help please ? Did I miss something in my HG settings ?
« Last Edit: November 17, 2014, 04:32:30 PM by bkenobi »

November 17, 2014, 07:18:49 AM
Reply #1

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
Is the program firing? You can try adding a notification to make sure that the program is run:

Code: [Select]
Program.Notify("Debug", "Program called, now attempting to send email.");
« Last Edit: November 17, 2014, 07:20:51 AM by mvdarend »

November 20, 2014, 11:31:43 PM
Reply #2

kiwi799

  • *
  • Information
  • Newbie
  • Posts: 10
Thanks mvdarend for the idea of program.notify.
I added one program.notify before and one after. Then the first tries only show the program.notify before the Net.SendMessage( recipients, subject, messagetext ).
So I clear all the program code and start from scratch, then it works with my local SMTP server :)
Then I tried again with Gmail or Yahoo.fr, but it was unsucessfull, I can see both program.notify. But did not receive email.
Finally I try with another email provider "free.fr", the one for my internet access and it does work  ;D
So now my mail notification works perfectly.
Thanks for your help.

November 23, 2014, 02:15:19 AM
Reply #3

Bobpick

  • *
  • Information
  • Newbie
  • Posts: 22
I am also running into issues with sending emails. I've set up Gmail according to the information I've found on this board.

I found this in my log:
2014-11-22T20:11:59.9192038-05:00   HomeAutomation.HomeGenie.Automation   NetHelper   Failure sending mail.   Exception.StackTrace      at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at HomeGenie.Automation.Scripting.NetHelper.SendMessage(String from, String recipients, String subject, String messageText)

Any suggestion?

November 23, 2014, 04:04:21 AM
Reply #4

jshan

  • ***
  • Information
  • Full Member
  • Posts: 71
I could not get GMail to work.  I ended up using yahoo mail with success.

November 23, 2014, 03:46:58 PM
Reply #5

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
The problem with GMail could be the missing ssl certificates.
These can be installed using mozroots command:
Code: [Select]
sudo apt-get install mono-devel
mozroots --import --ask-remove --machine
certmgr -ssl smtps://smtp.gmail.com:465

Reference: http://stackoverflow.com/questions/9801224/smtpclient-with-gmail

Cheers,
g.

November 23, 2014, 06:21:46 PM
Reply #6

Bobpick

  • *
  • Information
  • Newbie
  • Posts: 22
Gene,

I'm using Windows 8.1.  Those commands look like Linux commands.

November 23, 2014, 06:35:06 PM
Reply #7

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
I'm not sure but this looks like a similar solution for Windows:

http://www.arcencus.nl/Blogs/tabid/105/EntryID/39/Default.aspx

g.

November 23, 2014, 07:10:21 PM
Reply #8

Bobpick

  • *
  • Information
  • Newbie
  • Posts: 22
I'll give it a shot.

November 24, 2014, 01:26:50 AM
Reply #9

sourmush

  • Guest
Using port 587 instead of 465 will work for gmail.

October 12, 2015, 04:37:03 AM
Reply #10

nvuono

  • *
  • Information
  • Newbie
  • Posts: 1
Quote
The problem with GMail could be the missing ssl certificates.
These can be installed using mozroots command:
Code: [Select]
sudo apt-get install mono-devel
mozroots --import --ask-remove --machine
certmgr -ssl smtps://smtp.gmail.com:465

Reference: http://stackoverflow.com/questions/9801224/smtpclient-with-gmail

Cheers,
g.



This would not work for me until I took the additional steps of running:
Code: [Select]
mozroots --import --ask-remove --machine
certmgr -ssl smtps://smtp.gmail.com:465[quote author=Gene

Reference: http://www.mono-project.com/docs/faq/security/]
« Last Edit: October 12, 2015, 04:41:44 AM by nvuono »

October 16, 2015, 05:02:24 PM
Reply #11

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I tried these steps with yahoo and it didn't work.  All steps seemed to work but the resulting attempts to have HG send messages didn't end up in my inbox.  I guess I can try using my gmail as the send account if that works.

October 18, 2015, 06:00:52 PM
Reply #12

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I also tried switching over to using my gmail account and it also did not go through.  The only thing I can think of is trying to send the email manually in a Linux console to see what if any error messages I receive.

October 21, 2015, 11:23:30 PM
Reply #13

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
I just try on my side. With the Gene command line
Code: [Select]
sudo apt-get install mono-devel
mozroots --import --ask-remove --machine
certmgr -ssl smtps://smtp.gmail.com:465
and the de-sactivation on that link :
https://www.google.com/settings/security/lesssecureapps
It works !! :)

October 22, 2015, 06:20:31 AM
Reply #14

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Has something changed in the SendMessage function?  I used to be able to send a message with the following:
Code: [Select]
Net.SendMessage( "[email protected]", "email test", "test email from HomeGenie" );However, now when I run that code, I get an error in mono:
Code: [Select]
2015-10-21 21:13:03.9927 Error HomeAutomation.HomeGenie.Automation NetHelper Message could not be sent. Exception.StackTrace   at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) [0x00000] in <filename unknown>:0
  at HomeGenie.Automation.Scripting.NetHelper.SendMessage (System.String from, System.String recipients, System.String subject, System.String messageText) [0x00000] in <filename unknown>:0