more G-Labs products

Author Topic: SMtpClient.Send Exception  (Read 3459 times)

December 07, 2014, 09:32:43 PM
Read 3459 times

alpha23

  • *
  • Information
  • Newbie
  • Posts: 1
I'm receiving an exception similar to the following (from http://www.homegenie.it/forum/index.php?topic=320.0)

2014-08-22T06:55:45.4124340-07:00       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

smtp port is 25, no SSL.  I do not see any logs that will help resolve. 

To verify that the system could send emails, I tested with ssmtp and it works fine.

Thoughts on how to fix the above exception?

December 31, 2014, 11:58:17 PM
Reply #1

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL
I am having the same issue as well.

January 03, 2015, 04:55:49 AM
Reply #2

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL
I am still having this issue.  I just rebuilt the Pi today and re installed everything fresh and fully updated.  I have tried smtp.gmail.com, smtp-mail.outlook.com, and a secure SMTP server I run at work, and all give me

"2015-01-02T22:44:25.7565540-05:00   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 "

I have tested using telnet and am able to send from the pi.
(http://meganssmith.wordpress.com/2015/01/01/testing-email-part-two-the-telnet-ssl-way/)
(http://meganssmith.wordpress.com/2015/01/01/testing-email-part-one-the-open-ssl-way/)

I been looking for a way to trigger a test email in HG besides tripping the alarm, but I have yet to find it.  I have tried changing PWs to more "simple" PWs thinking maybe HG is having an issue parsing special characters, but that did not help.  Any ideas?

January 03, 2015, 08:47:59 PM
Reply #3

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL
So to add to this.  I created a testing app based off the code in the security app.

Code: [Select]
// send email
      //
      var subject = "HomeGenie Test emails by Lady Sapphy";
      var messagetext = "Test email sent from the Lady Sapphy test app";
      var recipients = "<my email addresses>";
      if (recipients != "")
        {
          Program.RunAsyncTask(()=>{
      Net.SendMessage(recipients, subject, messagetext);
            });
        }
        //
I run this from the program editor and it worked (using gmail as the SMTP server)
I trigger the security app, and still no emails
I add this app to the " Program to run when triggered" and it the app runs and sends email, but the emails from security does not send  ???

January 04, 2015, 10:33:13 PM
Reply #4

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL
I just wanted to say that with the update I got today, it seems to be working now!!!!!

January 04, 2015, 10:43:44 PM
Reply #5

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL
I may have spoke too soon.  It worked once  :'(

January 04, 2015, 11:31:00 PM
Reply #6

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
There are no changes regarding the NetHelper/Smtp in the latest update.
Btw I think the problem is about SSL certificates. To install them run the command:

Code: [Select]
mozroots --import --ask-remove --machine

Since HG runs as root user I am not sure if this command should also be run with sudo as well.

Cheers,
g.

January 05, 2015, 02:05:40 AM
Reply #7

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL
I don't think the issue is with the core HG code, I think it is with the security call.  I am using almost the same code in a test app and it works every time without fail.  The only change between security code and my code is I declare the vars explicitly where the security app is pulling them in from other places.

January 05, 2015, 02:16:21 AM
Reply #8

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Did you enable/configure the Messaging and Social->E-Mail Account app?
The security alarm app takes settings from there.

Cheers,
g.

January 05, 2015, 02:40:15 AM
Reply #9

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL
yes I did, my test app I posted above use the same call to get the SMTP info.

January 05, 2015, 02:42:10 AM
Reply #10

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Please add a issue to github then, so I'll be checking this out.
https://github.com/genielabs/HomeGenie/issues
g.

January 05, 2015, 02:47:05 AM
Reply #11

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL

January 13, 2015, 05:13:38 AM
Reply #12

LadySapphy

  • *
  • Information
  • Newbie
  • Posts: 15
    • REBEL GEEK GIRL
I think I might of found my issue. I am still testing, but I am 4 for 4 in testing now. It seems that I overlooked something in the install, my locale was set to en_gb instead of en_EN.  I changed mine to en_US (did not see en_EN).  Since that change, testing as worked every time although sometimes it takes over 10 min to send the email.