1. Catherine Ryan
  2. PowerBuilder
  3. Thursday, 8 March 2018 09:19 AM UTC

Hi all,

I am having an issue with PBNISMTP in PB2017. The same code works fine in PB12.0 - in the same environment (running on the same machine, using same email server etc…). The issue occurs in both the 2017 IDE and EXE.

As far as I can tell we have all the PB17 dlls in place and I successfully imported the pbnismtp2017.pbx into my PB2017 project. I also copied it into the Program Files(x86)\Appeon\Shared folder and our application directory.
Interestingly it’s when I get to the last line in my code (the Send function) that it throws the PBXRuntime error (Error calling method of a PBNI object). So it’s executing the rest of it ok.
l_smtp = CREATE n_cpp_smtp
l_smtp.SetRecipientEmail (ls_email )      
l_smtp.SetSenderEmail ( ls_sender )
l_smtp.SetSubject (ls_subject )
l_smtp.SetMessage ( ls_message, True )
l_smtp.SetSMTPServer ( ls_server)
//Send the email
li_rc = l_smtp.Send ( )

Any ideas why the Send function may be causing this error?
I've tested it in 2 different environments in both PB12 and PB17 - 12 works fine every time and 17 gives the same error every time.
Any help/thoughts appreciated!


Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 8 March 2018 13:37 PM UTC
  2. PowerBuilder
  3. # 1

Try downloading PBNISMTP from here:


PBNISMTP was originally written by Bruce Armstrong. I added some new features and updated it to a newer version of the SMTP class. I also removed version number from the file name as none of the code is version dependent.

Give this a try and if you have any issues, you can reply here or the topwizprogramming Facebook page.

  1. Milton Jiménez
  2. Thursday, 3 March 2022 18:23 PM UTC
ok thanks,
  1. Helpful
  1. Menna Pablo Javier
  2. Wednesday, 16 November 2022 17:47 PM UTC
Hi Roland, I have an error calling the Send() method:

ID Error = -4

"El nombre de entidad de seguridad de destino es incorrecto."

Any idea the reason for this error message?

  1. Helpful
  1. Roland Smith
  2. Wednesday, 16 November 2022 17:57 PM UTC
In English: The target principal name is incorrect.

Seems to be some sort of problem with the security certificate.
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.