genielabs / HomeGenie

HomeGenie, the programmable automation intelligence
https://homegenie.it
GNU General Public License v3.0
392 stars 155 forks source link

email fails to communicate with SMTP server #25

Closed bkenobi closed 9 years ago

bkenobi commented 9 years ago

Neither Yahoo nor gmail appear to work as a valid smtp servers within HG. I can manually send a message from my RasPi using openssl, so I know my system and inputs are correct. From reading various sites, it looks like the issue is caused by servers running ssl on port 465 when .NET is used. There is a workaround specified in the following stackoverflow post:

http://stackoverflow.com/questions/1011245/how-can-i-send-emails-through-ssl-smtp-with-the-net-framework

Details of my tests are at:

http://www.homegenie.it/forum/index.php?topic=320

bkenobi commented 9 years ago

It looks like the issue may be that the method being utilized does not support Implicit SSL connections. According to the following article, this is a known limitation that will not likely be fixed. They recommend CDO as a workaround.

http://blogs.msdn.com/b/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx

The code example from the OP uses System.Web.Mail instead of System.Net.Mail, which is the same workaround.

bkenobi commented 9 years ago

Although implicit SSL stil does not work, I found that connecting to port 587 at yahoo.com does work (explicit SSL mode). This would be good to fix but a workaround exists so it can be considered lower priority.

nvuono commented 8 years ago

Found the solution to this for gmail and a similar solution probably works for yahoo if you change the URL used in the command they use for intermediate certs at http://www.mono-project.com/docs/faq/security/ under the heading for the question "Does SSL work for SMTP, like GMail ?" :

 mozroots --import --ask-remove --machine
 certmgr -ssl smtps://smtp.gmail.com:465
bkenobi commented 8 years ago

Looks like mozroots isn't installed on the HG RPi image. I'll update my backup and try installing mozroots so I can try this.