HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: naps1saps on November 02, 2016, 09:14:06 PM

Title: Can't get email to work
Post by: naps1saps on November 02, 2016, 09:14:06 PM
I can't get my email to work with or without SSL (ports)  The SSL checkbox won't stay unchecked either.  I'm stuck.  Anyone else having this problem?  r525
Title: Re: Can't get email to work
Post by: dani on November 03, 2016, 09:52:09 AM
Yes by default if you look at the parameter the check box is always On. but if you uncheck and save, the mail sender works without SSL. For me Mail sending works without SSL.
Title: Re: Can't get email to work
Post by: naps1saps on November 03, 2016, 11:43:43 PM
by "save" do you mean the restart button on the window?  If I do that and re-open the window it is checked again.  I've tried unchecking with and without ssl ports and leaving it checked with and without ssl ports and nothing seems to want to work.  Not even my localhost relay server.
I did randomly receive an email twice but it was over 12 hours since it was sent.

Seems HG is sending the message but there is a problem with the message itself?  Emails are going out just fine from my php site using this relay.

Here is my mail server log trying to relay the email:

"DEBUG"   1912   "2016-11-03 17:12:18.821"   "Creating session 698"
"TCPIP"   1912   "2016-11-03 17:12:18.822"   "TCP - 192.168.0.3 connected to 192.168.0.3:25."
"DEBUG"   1912   "2016-11-03 17:12:18.830"   "TCP connection started for session 697"
"SMTPD"   1912   697   "2016-11-03 17:12:18.830"   "192.168.0.3"   "SENT: 220 epicdecals.com ESMTP"
"SMTPD"   1904   697   "2016-11-03 17:12:18.835"   "192.168.0.3"   "RECEIVED: EHLO ****"
"SMTPD"   1904   697   "2016-11-03 17:12:18.835"   "192.168.0.3"   "SENT: 250-epicdecals.com[nl]250-SIZE 20480000[nl]250-AUTH LOGIN[nl]250 HELP"
"SMTPD"   1904   697   "2016-11-03 17:12:18.836"   "192.168.0.3"   "RECEIVED: MAIL FROM:<********@comcast.net>"
"DEBUG"   1904   "2016-11-03 17:12:18.837"   "Total spam score: 0"
"SMTPD"   1904   697   "2016-11-03 17:12:18.840"   "192.168.0.3"   "SENT: 250 OK"
"SMTPD"   1892   697   "2016-11-03 17:12:18.844"   "192.168.0.3"   "RECEIVED: RCPT TO:<*********@gmail.com>"
"SMTPD"   1892   697   "2016-11-03 17:12:18.846"   "192.168.0.3"   "SENT: 530 SMTP authentication is required."
"DEBUG"   1892   "2016-11-03 17:12:18.848"   "AWStats::LogDeliveryFailure"
"DEBUG"   1896   "2016-11-03 17:12:18.849"   "The read operation failed. Bytes transferred: 0 Remote IP: 192.168.0.3, Session: 697, Code: 2, Message: End of file"
"DEBUG"   1896   "2016-11-03 17:12:18.850"   "Deleting message file."
"DEBUG"   1896   "2016-11-03 17:12:18.850"   "Ending session 697"
"DEBUG"   1912   "2016-11-03 17:12:27.207"   "Creating session 699"
"TCPIP"   1912   "2016-11-03 17:12:27.207"   "TCP - 192.168.0.3 connected to 192.168.0.3:25."
"DEBUG"   1912   "2016-11-03 17:12:27.210"   "TCP connection started for session 698"
"SMTPD"   1912   698   "2016-11-03 17:12:27.211"   "192.168.0.3"   "SENT: 220 epicdecals.com ESMTP"
"SMTPD"   1912   698   "2016-11-03 17:12:27.216"   "192.168.0.3"   "RECEIVED: EHLO *****"
"SMTPD"   1912   698   "2016-11-03 17:12:27.217"   "192.168.0.3"   "SENT: 250-epicdecals.com[nl]250-SIZE 20480000[nl]250-AUTH LOGIN[nl]250 HELP"
"SMTPD"   1912   698   "2016-11-03 17:12:27.217"   "192.168.0.3"   "RECEIVED: MAIL FROM:<***********@comcast.net>"
"DEBUG"   1912   "2016-11-03 17:12:27.219"   "Total spam score: 0"
"SMTPD"   1912   698   "2016-11-03 17:12:27.223"   "192.168.0.3"   "SENT: 250 OK"
"SMTPD"   1892   698   "2016-11-03 17:12:27.224"   "192.168.0.3"   "RECEIVED: RCPT TO:<************@gmail.com>"
"SMTPD"   1892   698   "2016-11-03 17:12:27.226"   "192.168.0.3"   "SENT: 530 SMTP authentication is required."
"DEBUG"   1892   "2016-11-03 17:12:27.226"   "AWStats::LogDeliveryFailure"
"DEBUG"   1896   "2016-11-03 17:12:27.229"   "The read operation failed. Bytes transferred: 0 Remote IP: 192.168.0.3, Session: 698, Code: 2, Message: End of file"
"DEBUG"   1896   "2016-11-03 17:12:27.229"   "Deleting message file."
"DEBUG"   1896   "2016-11-03 17:12:27.230"   "Ending session 698"
Title: Re: Can't get email to work
Post by: naps1saps on November 04, 2016, 01:31:51 AM
Then I try again for a 7th time and I get an email.
Test the security system and it doesn't even attempt to send an email.....
Run my test program again and I receive emails.

So it seems to be working now for some reason but not for the intended purpose of the security system -_-

What is going on????
Title: Re: Can't get email to work
Post by: naps1saps on November 04, 2016, 01:48:09 AM
And now after re-typing my email address in the security program, its sending emails now.  And yes... i had the right email in there before.  I don't get why its so flaky to set up.  This isn't the first time I've had this problem.  Had it about 3 times now over the years trying to set up the system from scratch.

Sigh... oh well.  At least it's working now.
Title: Re: Can't get email to work
Post by: GlenDLF on November 23, 2016, 03:59:57 AM
I've been trying to get the security system to send me an email for about 3 months now.  I have followed the directions in some of the threads ie - drop the @gmail.com from the username, etc, to no avail.  I've tried turning the SSL off, various email accounts - hotmail, gmail and still cannot get anything working.  I have enabled the "allow less secure apps" in my gmail account.  I'm using port 587 and smtp.gmail.com.  Nothing works.
Title: Re: Can't get email to work
Post by: nolio on November 23, 2016, 07:01:48 AM
Have you take a look in your spam folder ?
I have done this operation a long time ago, but I remember I import ssl certificate (how-to is on this forum) and perhaps "less secure app" (not sure it was for HomeGenie)
Title: Re: Can't get email to work
Post by: petediscrete on January 04, 2017, 05:05:11 PM
I've just experienced the same situation on r525 over the last couple of weeks using Gmail.emails are no longer sending. I've also noticed that the SSL checkbox will not remain unchecked so you cannot disable SSL. The HG email program clearly needs to be modified to reflect this.

Maybe Google updated their security certs again recently.
Title: Re: Can't get email to work
Post by: mchias13 on January 05, 2017, 01:19:34 AM
If you are running on a pi try the info I provided at the bottom of this thread: http://www.homegenie.it/forum/index.php?topic=1209.msg9144#msg9144 (http://www.homegenie.it/forum/index.php?topic=1209.msg9144#msg9144)

It worked for me.  All I used it for was to send email not receive them. You only need to install postfix (step 1).
Title: Re: Can't get email to work
Post by: petediscrete on January 05, 2017, 02:22:29 AM
Yes I noticed that post.

I'm really trying to find out why suddenly email notification stopped working.I made no changes to HG.Running HG rc525 on Rasbian Wheezy for the last couple of months with no problems.Haven't tried updating Wheezy anyway as updates are no longer supported.I've checked everything I can think of with no luck.
Title: Re: Can't get email to work
Post by: bkenobi on January 05, 2017, 03:23:09 AM
My guess would be certificate related.  I believe last time things stopped working for me out of the blue it was an update that either Gene or Yahoo made (don't recall which).  One thing you could try is to restore an older version that was working and the associated backed up settings (assuming you have that).  If it still works, it's something with HG.  Otherwise, it must be related to gmail.  That would mean an update to certificates and/or something else on gmail.
Title: Re: Can't get email to work
Post by: petediscrete on January 05, 2017, 03:53:39 AM
Have an rc519 image on an SD card so it was one of the first options I tried. No luck either. I also used a known working rc525 image which I used and same story.

I'm convinced it's Mono related and probably security certificate related. Everything is now Mono 4x related and as Wheezy is no longer supported I think what I stated in a previous has come to pass. HG relies heavily on Mono running on Linux.

I'm curious to know if anyone has HG running on Raspbian Jessie or even if HG has been fully tested on it.

I'm now using Homeseer 3 on the RPI under Raspbian Jessie and email notification is working fine. For sending email, which is all I need, using SMTP.GMAIL.COM the Port setting is 25 and SSL is disabled.

I can't see a solution in sight for this problem. I have tried virtually every solution I can think of. I do know that security certificates are generally only valid for a certain period. As I was not using HG over the Christmas period, I'm wondering if the change over to a new year has had any bearing on the problem. Just a shot in the dark.
Title: Re: Can't get email to work
Post by: bkenobi on January 05, 2017, 04:16:49 PM
I use yahoo instead of gmail but understand the frustration.  I had a working setup at one point that simply stopped.  It took months of tinkering to figure out the issue.  IIRC, in that case it came down to yahoo changing policies such that an app specific password had to be used and concurrently the certificates needed updating.  I used gmail at that time for testing and I think it worked, but that was a long time back.  Prior to the issues, I had been using email notification for a lot.  But, since I found it troubling that a critical notification could be lost due to some certificate or policy update on the email server's side, I changed my approach.

I still wish I could get text message support back similar to how I had AHP setup.  In that case, I used google voice to send/receive coded messages from my phone to control and report.  It was really nice to be able to do that without worry of an instantaneous connection to the server.  When it got through, it would do its thing.  When it sent a message, it didn't matter if I was temporarily out of range.  Right now, the app is good, but nothing like what I used to do.
Title: Re: Can't get email to work
Post by: petediscrete on January 05, 2017, 09:59:05 PM
Yes I am finding that too.It's taking so long to sort out the email problem I'm strongly thinking of abandoning HG. There was a post a while back about the impending death of HG and I stuck with it but with email notification failing for me things are not looking too good.

I've tried installing on Jessie but a lot of the previous posts refer to Wheezy and are no longer relevant,

My backup image of HG on SD card is Wheezy so I can't update/upgrade through the normal channels now.

I think I will park up HG for the moment and see what Gene's plans are for further development/maintenance.

ps The following is a snippet of the log referring to the non delivery of the email.

2017-01-05 21:34:42.3011 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
Title: Re: Can't get email to work
Post by: bkenobi on January 06, 2017, 05:42:16 PM
I don't know what Gene's priorities are so I can't speak for his future plans.  Over the last few years that I've been using HG and contributing scripts, I'd say that Gene has spurts of high activity and then nothing (on the forum anyway).  In the past there was a pretty strong tester base that he could upload a pre-release HG version and get feedback.  I got to the point where it was upsetting my wife that things would stop working and so I had to stick to a stable version that did everything I need.  I haven't seen a lot of others commenting in that section for quite some time, so it's possible that others are content with how it's running too.

That said, I recently saw that Wheezy is dead and Jessie is the only downloadable option through normal channels.  If I have to start over (almost did last month), it sounds like Jessie could be problematic.  There are users that have it running, but getting mono set up correctly is apparently a bit of an issue.  Perhaps someone using Jessie could update my step-by-step guide to be Jessie friendly?  I may take on that task at some point, but I'm currently struggling to get my github-to-PC linked up again.   :o
Title: Re: Can't get email to work
Post by: kevinvinv on February 03, 2017, 02:57:38 AM

Just my .02,    I am a newbee to the pie but I installed the latest Jesse or whatever it is and didnt have a single problem with Mono... ?

Title: Re: Can't get email to work
Post by: petediscrete on February 04, 2017, 01:15:37 AM
Yes Jessie and Mono 4x sorts out all those nasty security certs issues. I've a separate HG  image running on Jessie and email notification works fine. I have it working on Wheezy too but a lot more involved to achieve this.
Title: Re: Can't get email to work
Post by: Jens on February 04, 2017, 06:42:34 PM
I am using R526 on wheezy and mono 4.2.3, installed the certs by

- certmgr -ssl smtps://smtp.gmail.com:465
and
- sudo certmgr -ssl smtps://smtp.gmail.com:465

Certs are update in mono config directory

Check with
- echo "" | openssl s_client -tls1 -showcerts -connect smtp.gmail.com:465

looks okay from what I can tell

But not a single e-mail is being sent, also tried Port 587.

In June Gene mentioned a bug
http://www.homegenie.it/forum/index.php?topic=466.15 (http://www.homegenie.it/forum/index.php?topic=466.15)

I checked the 526 source and the change went in.

Anybody any idea what to check next?

Thanks
Bests
Jens
Title: Re: Can't get email to work
Post by: petediscrete on February 04, 2017, 08:20:57 PM
Jens ensure you have mono-complete installed and try again.
Title: Re: Can't get email to work
Post by: petediscrete on February 04, 2017, 08:26:09 PM
I'd ensure you follow this link to install Mono complete. The GPG signing seems to look after any certs issue.

I'm assuming the rc526 is a typo error. As far as I know it's rc525 on HG.

http://www.mono-project.com/docs/getting-started/install/linux/ (http://www.mono-project.com/docs/getting-started/install/linux/)
Title: Re: Can't get email to work
Post by: Jens on February 04, 2017, 10:36:47 PM
Yes, this is how the installation went, including the ca-certificates-mono.

No, 526 is no typo, you can download it from the source code and compile it yourself. Subjective impression is, that it runs faster than 525. Maybe due to the change in regards to css

snippet from history:
07/07/2016 v1.1-beta.526
    - Fixed Camera widget 'hanging' bug when displaying multiple cameras on a page, also increased refresh speed
    - Fixed side menu refresh bug
    - Fonts are now embedded in css (no more delay downloading from google fonts)
    - Fixed SSL error when sending e-mails
    - Other minor fixes/improvements


Title: Re: Can't get email to work
Post by: petediscrete on February 04, 2017, 11:01:09 PM
That's interesting about fixing SSL certs. Email notification has become such an issue for many people. Obviously you have tried this version rc526 but it hasn't resolved yours.

All I can say is that I backed up my HG Wheezy version RC525 and created a new Jessie image, updated it and installed Mono-complete as per my instruction above, restored my settings and it works.

Surprised that Gene never made this version available as a precompiled version. I might try downloading it and compiling it myself to check the results.
Title: Re: Can't get email to work
Post by: Jens on February 05, 2017, 12:41:31 PM
Did a network trace and found out that TLS handling was aborted with "bad certificate".

Got it working by

cert-sync /etc/ssl/certs/ca-certificates.crt

certmgr was used already before to pick the certificate but now its working well.
Title: Re: Can't get email to work
Post by: petediscrete on February 05, 2017, 01:53:05 PM
Good news Jens but not everybody will have the level of knowledge you have to achieve this result. Maybe it's time for an overhaul of HG to reflect the development in Raspbian Wheezy v Raspbian Jessie. Since I upgraded to Jessie I haven't managed to get the Pi CSI camera module working with HG.
Title: Re: Can't get email to work
Post by: pinie_pinie on March 08, 2017, 05:00:11 PM
The data in the email account are correct. I have already checked this.
Nevertheless, the sending of emails works.
I absolutely lack a good idea.

Is it really so hard to send an email under HG?

Many Thanks!

Thoralf
Title: Re: Can't get email to work
Post by: bkenobi on March 08, 2017, 08:30:47 PM
No it's not once it's set up correctly.  When it's not working, debugging has been difficult in the past.