Author Topic: Message Handler  (Read 9013 times)

ddddd13

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Message Handler
« Reply #15 on: June 15, 2019, 03:44:11 PM »
I copied them over and now I get a bunch of errors form change button undeclared ect ect ect These are left over from the last form I am sure.

Dave

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Message Handler
« Reply #16 on: June 15, 2019, 03:47:03 PM »
- Open your first solution in Visual Studio
- In Solution Explorer right click AdvancedHMI and select Add->Existing Item
- Browse to the folder where you saw the 2 files
- Select the OperatorReports.vb and click the Add button
- It may ask to replace files 2 or 3 times, click Yes each time

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Message Handler
« Reply #17 on: June 15, 2019, 03:49:58 PM »
Check to see if both solutions use the same version of AdvancedHMI

- Open your first solution
- In Solution Explorer, right click the AdvancedHMI project and select Properties
- In the Application Tab click the Assembly Information button
- Make note of the Assembly Version
- Repeat this for the second solution

Do they match?

ddddd13

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Message Handler
« Reply #18 on: June 17, 2019, 08:20:39 AM »
I finally got it all straightened out. It is hard to tell but I think if I stop the program with a value other than 0 MessageHandler1.Value It corrupts the program. If I make sure the value is 0 before ending it does not crash. Does that make sense? Moving on!

The attached is the error log using excite and gmail emails. I have tried using yours but it seems to have been turned off. Excite rejects the connection all together. gmail reports unrecognized command even with the wrong address.

Can you recommend a email provider?

Thanks,
Dave

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Message Handler
« Reply #19 on: June 17, 2019, 11:16:20 AM »
Getting the public email servers to relay email from an application can sometimes be tricky. They usually have precautions in place to keep spam bots from flooding their servers. For me Gmail has been the most difficult because of their tight security.

For excite it looks like the SMTPserver is smtp.excite.com
SMTPLoginUserName is your email address
SMTPLoginPassword  is your email password
SMTP port 465

One place did say UseSSL must be true.


ddddd13

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Message Handler
« Reply #20 on: June 17, 2019, 01:23:48 PM »
Archie;

I could not get gmail to work. I tried mail.com and it would send about 50% of the e-mails however, now it won't send any it just comes back with mailbox unavailable.

But now I have the form eater problem coming back in. I get the alarm. The designer can not process the code at line 77: Me.MessageHandler1=new AdvancedHMIControls.MessageHandler() The code within the method 'Initialize Component' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.

I have not changed this code and the only thing I write to is MessageHandler1.Value= (0 when I exit 1 when I click a button) Setting it to 0 on exit has prevented this problem all morning but now it is back. I can do a clean I can exit and start again but it will give me the same error. I have learned and saved a copy without the error to a different directory and can just copy that version over the top of the one with the error. But this has always been a problem for me. If I press the ignore and continue it will eat the form!
Thanks
Dave

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Message Handler
« Reply #21 on: June 17, 2019, 01:54:43 PM »
Did you try

- Windows->Close All Documents
- Exit Visual Studio
- Re-open Visual Studio
- Build->Rebuild Solution

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Message Handler
« Reply #22 on: June 17, 2019, 02:26:35 PM »
If you had mail.com work initially then stop, my guess is that you reached the daily limit of outgoing relays.

ddddd13

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Message Handler
« Reply #23 on: June 17, 2019, 03:42:22 PM »
Archie;

Remember I have rebooted the computer! Once that file gets corrupted you dead, dead, dead! You need to erase it and copy a previously saved version into its place.

Daily limit of emails? What do you mean to send thru advanced hmi or the email server. I am now trying fastmail.com and am getting different errors. Look at the attachment. Pay attention to the time. It shows an email attempt every 2 minutes yet in the emailer file it should be emailing every minute???

Dave

ddddd13

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Message Handler
« Reply #24 on: June 17, 2019, 03:43:26 PM »
The error log

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Message Handler
« Reply #25 on: June 17, 2019, 03:55:33 PM »
Remember I have rebooted the computer! Once that file gets corrupted you dead, dead, dead! You need to erase it and copy a previously saved version into its place.

Daily limit of emails? What do you mean to send thru advanced hmi or the email server. I am now trying fastmail.com and am getting different errors. Look at the attachment. Pay attention to the time. It shows an email attempt every 2 minutes yet in the emailer file it should be emailing every minute???
Even if you reboot the PC, it will not fix it. The most important step is to do the Windows->Close All Documents. Otherwise VS just re-opens into the same error. This is a known issue with VS2019 and I see it on a daily basis, but I have never "lost" a form.

The daily limit is set by the hosting email server. I have not been able to find the limit set by mail.com , but this web site will give you a general idea of limits that providers set:

https://docs.mailpoet.com/article/49-lists-of-hosts-and-their-sending-limits

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Message Handler
« Reply #26 on: June 17, 2019, 03:58:52 PM »
Can you attach your AlarmToEmail.txt file?

ddddd13

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Message Handler
« Reply #27 on: June 17, 2019, 04:45:55 PM »
Archie;

I changed from fastmail back to mail. I got 5 emails to send the sixth did not go thru. The following is the error I am getting in the log.


6/17/2019 3:38:58 PM - Send Message : This operation cannot be performed while a message is being sent.
6/17/2019 3:38:58 PM - An asynchronous call is already in progress. It must be completed or canceled before you can call this method.
6/17/2019 3:38:58 PM - System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was:
   at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
   at System.Net.Mail.SmtpTransport.EndGetConnection(IAsyncResult result)
   at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)

Is this the Message Handler thinking it is not complete?

Attached is the emailer file.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Message Handler
« Reply #28 on: June 17, 2019, 04:58:09 PM »
It's trying to send the next email before the last was completed. The easiest fix is to use a synchronous send.

- In Solution Explorer, right click MessageHandler.vb and select View Code
- Go to line 288 and look for "Client.SendAsync(mm, Nothing)"
- Change that line to
Code: [Select]
Client.Send(mm)

ddddd13

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Message Handler
« Reply #29 on: June 17, 2019, 05:19:16 PM »
Archie;

it was on line 286 and I changed it but I get the alarm mailbox unavailable. I looked at mail.com and they claim they do not limit the number or  size of emails but they do limit what they might consider spam. These emails all look the same and they may consider them spam. I will wait a couple of hours and try again. If it works my problem is solved.
At this point do you suggest putting 286 back to the way it was.

Dave