Skip to Content
avatar image
Former Member

Problem with n_cpp_smtp

We use a mailing window to send bills to customers. It prefills everything except the email address which the customer service rep types in before sending and it works fine.

In order to make a more useful version (able to type messages and select attachments) I copied the existing class (renamed it) and created a helper class with variables for mailto, subject, message, and attachment. The emailing code is the same as the existing mailer it was copied from, but when I run it it fails at the first call to the object with the 'bad runtime function reference' message.

I have tried putting the pbx file in the folders where the app runs from, where the window is located and also tried copying my mailing window into the directory where the other one runs from just fine. Nothing gets it working.

I am not sure what else to do in this case - Windows 7 64bit, PB11.2 build 8669, pbx build '5/24/2010'

Thanks for any help.

VR,

jeff

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Mar 13, 2017 at 07:32 PM

    A pbx is just a dll written in C++ that was named differently. The object n_cpp_smtp is a shell that gives you an easy to use interface to the pbx.If you change the object, it will lose the reference to the pbx and no longer work. Even if the reference were maintained, the C++ code won't be aware of your changes.

    Try this SMTP example instead. There are no pbx or other external files.

    http://www.topwizprogramming.com/freecode_emailsmtp.html

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for your quick reply Roland,

      I looked at what you linked, but, for consistency, I will have to check with be boss before I make any big changes since we have this same setup in other places and they work. I am just trying to get my 'copy' to function for now.

      In describing what I have done so far I think I wasn't clear enough.

      I am using n_cpp_smtp - the object I copied is the window we show and all the objects and code that are on it. It has it's own n_cpp_smtp instance variable - you can have more than one in a project correct? What I did was opened the working email window and did a save as into another library with a modified name for my 'generic' email window. I then took out all the predefined information and created the helper class to pass them in and fill in the blanks - I didn't touch any other code except replacing the filled in fields with my passed in data. Once the information is all updated I then create an n_cpp_smtp instance and try to use it, but that is where it keeps failing.

      I am running from the IDE and have put the pbx several different folders and verified that n_cpp_smtp is in the path. Each time I try I still get the 'bad runtime function reference' at the first line where I am passing in the 'mailto' which I have verified is a valid email address string.

      Sorry for any confusion,

      VR,

      jeff

  • avatar image
    Former Member
    Mar 14, 2017 at 06:17 PM

    Do you have a Create statement for the instance variable in the new window?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 21, 2017 at 05:38 PM

    Hey Roland,

    I commented on your last post, but haven't heard a reply.

    The issue is still on going. I even compiled my code and copied the pbds into a directory where the main code resides and it still is giving me the function error. I can email from the object I created my copy from, but still not my copy.

    Thanks,

    jeff

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 22, 2017 at 04:13 PM

    I found a question on the old user forum from 2005 where the user had the same problem:

    http://nntp-archive.sybase.com/nntp-archive/action/article/%3C41f6528f.4e77.1681692777%40sybase.com%3Ehttp://nntp-archive.sybase.com/nntp-archive/action/article/%3C41f6528f.4e77.1681692777%40sybase.com%3E

    If you do "Import PB Extension" it will create the object in a library so you won't need the PBD.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 24, 2017 at 07:50 PM

    We have pbnismtp110.pbx build 10/28/2008 10:14., but no pbd for any 110 version. It works for every other program except my current project..

    Every time I try importing the 110pbx I get the error - 'not a valid dll or pbx file'.

    I have the zip for the 12.6 version, but that won't run with 11.2 (will it?).

    We had the old pbnismtp.pbd/pbx combo from 2004 and I was able to import it successfully, but I still get the same 'bad function call' error when I try to email.

    I will keep looking on my end and let you know if I find something that works and I appreciate your help. Please let me know if you think of or find any new information for me to try.

    Thanks,

    jeff

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 29, 2017 at 07:43 PM

    You have to use a version that matches PowerBuilder.

    The PBD is only needed for PB9/PB10. Starting in PB 10.5 you can import the PBX directly into a library.

    Isn't there also a Java component that goes with it?

    Add comment
    10|10000 characters needed characters exceeded