Any new ideas how to get email working in HG?

@mike, take a look at this question on StackOverflow, may be it will help https://stackoverflow.com/questions/39724474/client-email-c-sharp

  1. Have you tried port 587 as I suggested.
    – yes, both 465 & 587 on all 3 accounts (gmail, yahoo & non SSL private account)
  2. Have you confirmed that SSL is ticked in the email configuration account.
    – yes, and unticked on trying my non SSL email
  3. Have you used port checker to find out if the relevant ports are opened and listening for that service.
    – no as I use both these ports on many computers on this intranet every minute
  4. Does your isp allow this service on those ports.
    – yes. They shut off port 25 a year ago and we have switched all (10-15?) email accounts here over to either 465 or 587 since.

I assume you don’t use two step verification and you have less secure apps enabled in Google.

There hasn’t been an issue with email notification in HG since Mono 5.4 and I can confirm that the standard email notification program supplied as it is works fine.

Any modification to that program I can’t and won’t comment on as I’ve no idea how it is being edited and compiled.

When you are installing HG from the homegenie.it you may want to change the source to Mono to 5.4 by editing your apt sources list and doing so prior to installing HG.

There’s plenty of posts on the forum on how to do that.

Can you send emails from this RPi/PC using another software?

Thanks Bounz. I checked out the thread on io exception you mentioned, and all its offshoots. I have a feeling it is something else, so I have a fresh pi running and plan to load HG on it next to try. I do not have any other software on the pi other than HAbridge so no other email testers.

Try to use this program to test email sending: EmailTester.exe (6.5 KB)

You can run it with mono EmailTester.exe command.

@Bounz it would be interesting to see exactly what email notification program the OP is using. Is it the one from the original HG forum or has it been modified in some way. Is it compiling correctly without errors in HG. Maybe info like this would help you troubleshoot this matter a little easier.

The OP is using Mono 5.4 so I see no reason why certificates should be an issue in this case. The email notification program is working here in its original unmodified form with no problems.

The OP is using the default HG email sender program. No midifications. The OP posted his log files showing the error. It compliles fine, no errors. The OP even has a non SSL email account he has tried, setting SSL support to both on and off. The OP has now started a totally separate pi with new HG program, and it faults the same way. Thank you bounz for your mono email seperate program. This OP will be tryng it as soon as he gets a chance, and will report back. Thank you!

That’s good to hear. There’s modified versions of the original email notification program circulating that do not compile properly. Hacked versions of the original code.

Maybe you could download a copy of VS2017 and compile the program for yourself. It’s an easier environment to work in as it has an IDE that can check your syntax to rule out obvious syntax errors.

The original version of the email notification program is working fine with both HG BE v1.1.22 and HG v.1.2 stable .38. Both were tested with Mono 5.4

Bounz

1d

Try to use this program to test email sending: EmailTester.exe (6.5 KB)

You can run it with mono EmailTester.exe command.

DONE. FAILED. (NOT SSL)

pi@X10Hub:/tmp $ mono EmailTester.exe
Email receiver address: [email protected]
Email sender address: [email protected]
SMTP server (default value = smtp.gmail.com): xxxxxashere.com
SMTP port (default value = 587):
SMTP user name: [email protected]
SMTP user domain (leave blank, if you don’t know):
SMTP password: xxxxxxxxxxxxxxx
Use SSL? (1-yes, 0-no) (default value = 1): 0

System.Net.Mail.SmtpFailedRecipientsException: failed recipients
at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x002f3] 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 EmailTester.Program.Main (System.String[] args) [0x000c2] in :0

Bounz, thank you very much fo rthis program to test my system! I will spend more time next trying gmail and yahoo email addresses.

so tried gmail account, same no go:

pi@X10Hub:/tmp $ mono EmailTester.exe
Email receiver address: [email protected]
Email sender address: [email protected]
SMTP server (default value = smtp.gmail.com): smtp.gmail.com
SMTP port (default value = 587): 465
SMTP user name: [email protected]
SMTP user domain (leave blank, if you don’t know):
SMTP password: xxxxx
Use SSL? (1-yes, 0-no) (default value = 1): 1

System.Net.Mail.SmtpException: Message could not be sent. —> System.IO.IOException: Connection closed
at System.Net.Mail.SmtpClient.Read () [0x000bd] in <8a8abae728c244359683ef777047ab9e>:0
at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x00000] 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) [0x00084] in <8a8abae728c244359683ef777047ab9e>:0
— End of inner exception stack trace —
at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) [0x0009f] in <8a8abae728c244359683ef777047ab9e>:0
at EmailTester.Program.Main (System.String[] args) [0x000c2] in :0
System.IO.IOException: Connection closed
at System.Net.Mail.SmtpClient.Read () [0x000bd] in <8a8abae728c244359683ef777047ab9e>:0
at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x00000] 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) [0x00084] in <8a8abae728c244359683ef777047ab9e>:0
pi@X10Hub:/tmp $

Just to check that this is not a network related problem, try to do this from your machine:

telnet smtp.gmail.com 465

Then you will need to press Ctrl+] to terminate the session and type quit in telnet> prompt to quit from telnet.

Please, share the results of telnet here.

I forgot how to get my cmd window to allow telnet; tried 2 different windows computers:

C:\Users\mike\OneDrive\Desktop>telnet
DNS server not authoritative for zone.

So I used putty set to telnet:

  • trying port 465 it crashes putty with error "server unexpectedly closed network connection.
  • using port 587 it seems to connect, saying immediately:
    220 smtp.gmail.com ESMTP z126sm15956508qkz.8 - gsmtp
  • then if I send nonsense it says:
    hi bob
    502 5.5.1 Unrecognized command. z126sm15956508qkz.8 - gsmtp

If I send GET it closes the putty session.

I use thunderbird for emails here on most computers, and so use smtp.gmail and other servers FWIW.

This makes sense. This error is the same as you get in HG and EmailTester when it says System.IO.IOException: Connection closed. Something in your network blocks connections to smtp.gmail.com:465.
I recommend you to use the same settings as you use in Thunderbolt. Also, as you are a Windows user, there should be no problem with security certificates.

@Bounz I wonder if the ssl box is correcty checked in HG. Port 587 is opened and is awaiting ssl authentication from HG according to the logs and is closing without it.

Depending on what browser is used that check box can be difficult to see. I did suggest in an earlier post that this could be the cause of the problem

Maybe a manual email test script run in HG with the correct settings could narrow this possibility down.

@mike, please do the final test with EmailTester and attach console output here.
In the test please use the following parameters:

Email receiver address: [email protected]
Email sender address: your gmail email address
SMTP server (default value = smtp.gmail.com): smtp.gmail.com (because this was your case in the first post)
SMTP port (default value = 587): 587
SMTP user name: your gmail email address
SMTP user domain (leave blank, if you don’t know):
SMTP password: your gmail email password
Use SSL? (1-yes, 0-no) (default value = 1): 1

Pete, the light blue check for SSL in HG is VERY OBVIOUS here.

There is ZERO chance it is checked or not checked: I have tried both ways with no difference.

How do you reply with copy of previous comment?

Bounzmy thunderbird uses port 465 & SSL for gmail accounts and works. My non SSL account uses port 587 and works…

So I think I can say my network allows using either port. My router lets me type in port numbers to check if they are open thru to the internet; both show open…

I now have TWO different pi zero W’s on my network, each running HG fine, neither allowing email sending…

Got a windows 10 64bit machine on my network to run telnet… it does exactly the same as putty telnet did. I will try to redo emailTester as directed soon.

What version of HG is being used here and what source was it downloaded from.

As per your previous posts you are using Mono 5.4 which would rule out any security cert issues.

To assist with troubleshooting it may be best to use either the Bounz BE edition or Genes directly from the GitHub.

A vanilla version of HG without any additions or modifications on a copy of Raspbian Stretch Lite fully updated and without your HG config restore will help greatly too.

It might also help to mention what other services are running on your LAN in parallel with HG.

I strongly doubt that the stock version of HG is your problem here. The above advice will help you to rule this in or out though.


pi@raspberrypi:/tmp $ mono EmailTester.exe
Email receiver address: [email protected]
Email sender address: [email protected]
SMTP server (default value = smtp.gmail.com): smtp.gmail.com
SMTP port (default value = 587): 587
SMTP user name: [email protected]
SMTP user domain (leave blank, if you don’t know):
SMTP password: xxxxxxxxx
Use SSL? (1-yes, 0-no) (default value = 1): 1

System.Net.Mail.SmtpException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials y11sm20546391qky.2 - gsmtp
  at System.Net.Mail.SmtpClient.CheckStatus (System.Net.Mail.SmtpClient+SmtpResponse status, System.Int32 i) [0x0001a] in <8a8abae728c244359683ef777047ab9e>:0
  at System.Net.Mail.SmtpClient.Authenticate (System.String user, System.String password) [0x00065] in <8a8abae728c244359683ef777047ab9e>:0
  at System.Net.Mail.SmtpClient.Authenticate () [0x000b1] in <8a8abae728c244359683ef777047ab9e>:0
  at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x00132] 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 EmailTester.Program.Main (System.String[] args) [0x000c2] in <f52881f4b95e4173863fe41e61ae275c>:0
pi@raspberrypi:/tmp $

same results on both pi s…

both HGs are latest gene ones, updated via inside HG itself. habridge is also on both pi s

using my non SSL sender:

pi@X10Hub:/tmp $ mono EmailTester.exe
Email receiver address: [email protected]
Email sender address: [email protected]
SMTP server (default value = smtp.gmail.com): zmail.kilroywashere.com
SMTP port (default value = 587): 587
SMTP user name: [email protected]
SMTP user domain (leave blank, if you don’t know):
SMTP password: xxxxxxxx
Use SSL? (1-yes, 0-no) (default value = 1): 0

System.Net.Mail.SmtpFailedRecipientsException: failed recipients
  at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x002f3] 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 EmailTester.Program.Main (System.String[] args) [0x000c2] in <f52881f4b95e4173863fe41e61ae275c>:0