Any new ideas how to get email working in HG?

#46

Here’s the original email notification program http://old.homegenie.club:8080/www.homegenie.it/forum/index620a.html?topic=1530.0

#47

142-E-Mail_Account.hgx (2.5 KB)

#48

Thank you both! I will try with them today when I get a chance. I just did not want to take a chance copying my none working one to the new pi.

#49

So frustrating! mono EmailTester.exe send using port 587 (non SSL per gmail) but trying to send thru HG using SSL or not fails everytime! mono EmailTester.exe fails using port 465 - so I assume from this EmailTester.exe does NOT use SSL…

Gmail report on less security says SSL uses port 465, non SSL (TLS/STARTTLS) uses port 587. So now we know the difference between those two ports!

My thunderbird is set to use SSL and IS using port 465… My non SSL accounts in same thunderbird use port 587 and are set to STARTTLS!)

So my network lets both ports thru (my router can test any port, and both show going thru fine also), thunderbird uses both SSL and TLS…

Fresh install of HG still does not let me send email.

#50

progress? turn off SSL (use port 587 imstead of 465 per gmail) results in new fault:

2019-03-03 14:04:25.2274 Trace SendMessage: called for recipients [email protected], [email protected]
2019-03-03 14:04:25.2279 Trace SendMessage: getting smtpSyncLock
2019-03-03 14:04:25.2279 Trace SendMessage: got smtpSyncLock
2019-03-03 14:04:25.2313 Trace SendMessage: going to send email System.Net.Mail.MailMessage using mailService ‘smtp.gmail.com’, port ‘587’, credentials System.Net.NetworkCredential, using SSL = False
2019-03-03 14:04:26.7587 Trace SendMessage: error sending email {0}
2019-03-03 14:04:26.7601 Error System.Net.Mail.SmtpException: 530 5.7.0 Must issue a STARTTLS command first. k33sm2372159qte.8 - gsmtp
at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x00189] in <8a8abae728c244359683ef777047ab9e>:0
at System.Net.Mail.SmtpClient.SendInternal (System.Net.Mail.MailMessage message) [0x00050] in <8a8abae728c244359683ef777047ab9e>:0
at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) [0x00091] in <8a8abae728c244359683ef777047ab9e>:0
at HomeGenie.Automation.Scripting.NetHelper.SendMessage (System.String from, System.String recipients, System.String subject, System.String messageText) [0x003f1] in <94bfeff8a52f4daaaf4c1c2fd3302d2a>:0
2019-03-03 14:04:26.7881 Error HomeAutomation.HomeGenie.Automation

at System.Net.Mail.SmtpClient.SendInternal (System.Net.Mail.MailMessage message) [0x00050] in <8a8abae728c244359683ef777047ab9e>:0
at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) [0x00091] in <8a8abae728c244359683ef777047ab9e>:0
at HomeGenie.Automation.Scripting.NetHelper.SendMessage (System.String from, System.String recipients, System.String subject, System.String messageText) [0x003f1] in <94bfeff8a52f4daaaf4c1c2fd3302d2a>:0

OR if sending with SSL security (port 465 using SSL):

wow… sent!!!

maybe required a reboot of pi and reboot of router here… wow!!!

#51

I think I found the issue: maybe a BUG in HG!

my log of good send after changing port to 465 & SSL:

2019-03-03 14:15:32.0374 Trace SendMessage: called for recipients [email protected], [email protected]
2019-03-03 14:15:32.0379 Trace SendMessage: getting smtpSyncLock
2019-03-03 14:15:32.0379 Trace SendMessage: got smtpSyncLock
2019-03-03 14:15:32.0410 Trace SendMessage: going to send email System.Net.Mail.MailMessage using mailService ‘smtp.gmail.com’, port ‘587’, credentials System.Net.NetworkCredential, using SSL = True
2019-03-03 14:15:34.5434 Error System.Exception: X10 CM15Pro device not connected.
at XTenLib.Drivers.CM15.Open () [0x00022] in <88a9a151687d49859b79420e03c2e909>:0
2019-03-03 14:15:36.2234 Info WebServiceGateway
2019-03-03 14:15:36.2476 Info WebServiceGateway
2019-03-03 14:15:37.1259 Trace SendMessage: disposing smtpClient
2019-03-03 14:15:37.1249 Trace Email sent

Screen shot of my e-mail account settings that finally worked:

#54

Assuming you are using Mono 5.4 make sure you recompile the Email Notification Program in HG, save it and do your test again.

Assuming you are using and have the correct information stored in the E-Mail Account program here’s a simple test email you can use to see if email will send in HG http://old.homegenie.club:8080/www.homegenie.it/forum/index81b1.html?topic=1079.0

#55

mono 5.4 I have not changed the programs so should not need to recompile. Just changing the parameters entered in OPTIONS.

FWIW, I cycled power on new HG pi and now it again will not send with any combination of port/SSL. (:

At least it is no longer reporting wrong port number.

#56

The reason to compile is to check for any possible errors and rule them out. Compile and save it.

I’ve no idea what cycling power could have done to your config unless you didn’t shut it down properly first.

Again without logs it’s just a crap shoot trying to figure your problem.

Finally could you confirm if at any stage you could actually send an email from within HG

#57

confirmed, I sent 4 emails to two different email addresses from new HG pi before shutting down (correct, I did NOT send ‘sudo power off’ first, I just pulled power).

As for compiling, most of these email programs give warnings (not faults) due to old obsolete command INPUT fields used (instead of updated OPTIONS commands). I am not concerned with those warnings at this point. I can go back in and rebuild the email programs to use the latest C commands later. But those warnings do not stop performance of the function.

There appears to be something going on with HG maybe not remembering updated port & SSL settings in OPTIONS (config->settings) settings on “142 E-mail Account”

Gmail says port 465 is required for SSL, 587 is required for STARTTLS. One test run caused HG log to say STARTTLS was not initiated as reason of fault (it showed port 587 & NO SSL). There appears to me to be some combination of reboots/saves/OPTIONsettings that is going on here…

#58

Once again check all your details are correct in the Email Account. Could have been corrupted when you pulled the plug. The SSL check box could have unchecked itself back to its default unchecked.

Use @Bounz email tester exe program again just to confirm everything is in order.

Again I’d advise compiling and saving the email notification program just to rule that out. Warnings can be problematic too.

To shutdown HomeGenie you really should sudo systemctl stop homegenie.service first then sudo shutdown now.

Port 465 for SSL. Port 587 doesn’t support SSL as far as I remember.

For all my notification activity I now use GMX. I find it more flexible and not as locked down as Gmail.

#59

Maybe I am not changing the e-mail account data correctly? Each time I do so then look at the log, it still often has the original gmail account info, not the changed stuff. After changing data in the OPTIONS windiow, I hit RESTART button and wait to try again.

Am I doing something wrong to not get my option changes entered?

#60

You need to save the changes before you restart the program otherwise it just defaults to the previous settings.

#61

There is no ‘save’ button in configure->settings page where the only ‘Options’ button is for 142 Email Account program.

There are only 2 choices: exit and restart; I have been makiing changes then hitting restart… that does save the changes to the options screen when I look next time… I pay attention of the bright blue SSL check box each time. Perhaps I will try a new round of tests with using the exit button instead of restart…

#62

I had a Issue with settings being maintained and questioned Gene about this some time ago. this was his reply:

HG does not save the configuration at every single change. This is mainly done to prevent stress of file system and mainly to preserve SD card on low energy devices.

The configuration is only saved if:

  • a graceful quit or restart is performed from the maintenance menu or sending a CTRL+C signal
  • a system backup or some other maintenance operation is performed (this will trigger configuration save)

So if you turn off or reset the operating system all of sudden, the latest configuration changes will be likely to be lost since the HomeGenie.SaveData() will not be called

#63

Thank you Tuicemen. I am finding the saving of new email account data is NOT saved as stated on HG screen… I just methodically went thru changing as shown:

2019-03-04 09:53:59.9684 Trace SendMessage: going to send email System.Net.Mail.MailMessage using mailService ‘mail.gmx.com’, port ‘465’, credentials System.Net.NetworkCredential, using SSL = True

PORT SSL? TIME

465 Y 9:42a (this is how it was from yesterday)
465 N 10:02
587 N 10:04
587 Y 10:05

Log shows no changes were made: ALL test sends used port 465 & SSL=true.

So my email issue is I have not yet figured out how to REALLY change Options on email account… this last time I used the EXIT button on config->settings_email account options instead of RESTART, the only other choice…

I have already tried the RESTART choice without the port/ssl changing so no sense trying that again.

Next I will delete the email account program and IMPORT it again fresh. Sheesh.

#64

Well, that does not change anything… deleted email account program, imported fresh copy back without any data in the options boxes, filled in as 587 No ssl… log shows it is still 465 and ssl…

So for kicks tried again changing just SSL to true and RESTART to quit settings… NOPE.

#65

So I added:

     Program.Notify("port", "Messaging.Email.SmtpPort", "options", "Email.SmtpPort");
     Program.Notify("ssl", "Messaging.Email.SmtpUseSsl", "options", "Email.SmtpUseSsl");

To show what the Options screen entry is and what the email account will actually use… perhaps from this I can decode why the options pages is not being transferred to the actual account variables…

#66

It looks like Gene had something to say on the matter via Tuicemen so maybe if you now post your issue on Genes HomeGenie GitHub you’ll get a satisfactory solution to your problem.

@Tuicemen was that information shared with other users here. It would have been nice to know trying to help a user resolve his issue.

Pity Gene hasn’t taken the time to contribute to issues like this here. It would save myself and others from addressing them. He did say he was watching out for posts like this here.

I have to say I haven’t experienced my changes to the Email Account program not being saved but maybe there are other forces at play here.

#67

The HG setting saving info was for all HG settings not just email.
Genes reply was to another issue I only mentioned it as mike stated after pulling the plug the settings were not maintained.
:thinking: I had assumed most long time HG users knew a ungraceful shutdown of HG would result in lost settings :roll_eyes: