Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Inner Exception Error In EasyOPCUA When Sending A Email

More
15 Feb 2023 15:07 #11536 by neilcooley
Thanks
Okay I will test with the latest release and come back if its still a problem.

Thanks

Neil

Please Log in or Create an account to join the conversation.

More
14 Feb 2023 18:03 #11534 by support
Hello, and thank you for the details.

I have had another user mention a problem that was very similar, if not identical. And, updating to latest QuickOPC (which the customer has done for another reason anyway) has resolved it. I have a reason to think that it might be caused by the underlying software (possibly the OPC UA stack), and newer QuickOPC versions use newer versions of these as well.

So, unless the problem is also reproducible with the newest QuickOPC, we are not going to look further into it - sorry.

Best regards

Please Log in or Create an account to join the conversation.

More
14 Feb 2023 17:02 #11533 by neilcooley
Thank you for your prompt reply.

1. Version running is OPCLabs 2019.2 5.56.475.1

2. The exception is generated on the line smtp_Server.Send(email).

At the moment I have done some investigation and i have found if i dont use a SSL certificate it then works - i.e. changing Smtp_Server.EnableSsl = True to Smtp_Server.EnableSsl = False. This allows the email to be sent without the inner exception but i would like to be able to turn SSL back on if possible.


Thanks

Neil

Please Log in or Create an account to join the conversation.

More
14 Feb 2023 15:44 #11531 by support
Hello.

I have some additional questions:

1. Which QuickOPC version are you using? - including the build number please.
2. Can you trace the program, and determine on which statement inside the try/catch block is the exception thrown?

Thank you

Please Log in or Create an account to join the conversation.

More
14 Feb 2023 10:22 #11530 by ncooley
I have a application that is using OPC UA SDK and I am trying to introduce a function that will send a email using the SMTP client.

the syntax for email send is;
Try
Dim Smtp_Server As New SmtpClient
Dim e_mail As New MailMessage()
Smtp_Server.UseDefaultCredentials = False
Smtp_Server.Credentials = New Net.NetworkCredential("***", "***")
Smtp_Server.Port = 587
Smtp_Server.EnableSsl = True
Smtp_Server.Host = "***"
Smtp_Server.Timeout = 10000
e_mail = New MailMessage()
e_mail.From = New MailAddress("***")

e_mail.To.Add("***")
e_mail.Subject = "Email Sending"
e_mail.IsBodyHtml = False
e_mail.Body = "Message Body"
Smtp_Server.Send(e_mail)
MsgBox("Mail Sent")

Catch error_t As Exception
MsgBox(error_t.ToString)
End Try

I am also have the line Imports System.Net.Mail

The code that sends the email works okay in a test application but when I try and do the same code in the OPC application, I get a error and the inner exception details is below.

Message = "Unable to cast object of type 'System.Net.Mail.SmtpClient' to type 'System.Net.HttpWebRequest'."
Source = "OpcLabs.EasyOpcUA"
StackTrace = " at OpcLabs.EasyOpc.UA.Toolkit.ClientServer.UAClientEngineBase.VerifyServerCertificate(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)" & vbCrLf & " at System.Net.ServerCertValidationCallback.Callback(Objec...
TargetSite = {Boolean VerifyServerCertificate(System.Object, System.Security.Cryptography.X509Certificates.X509Certificate, System.Security.Cryptography.X509Certificates.X509Chain, System.Net.Security.SslPolicyErrors)}


Can you advise if I am doing something wrong or how to send a email when also using OPC UA SDK ?


Thanks

Neil

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.063 seconds