Skip to Content
Author's profile photo Bruce Armstrong

FAQ: How can I send SMTP from PowerBuilder

PowerBuilder’s only native method of sending email is through Simple MAPI, which is very limited.  In particular, the approach was hampered quite a bit when Microsoft introduced security enhancements which resulted in security warnings being generated anytime Simple MAPI was used.

The most popular approach for addressing this has been to use SMTP to send email instead.  There are quite a number of third party tools that can be used to accomplish this:

  • Topwiz Software’s EmailSMTP is a PowerBuilder non-visual user object that uses Windows API calls to send SMTP.
  • This blog post explains how to create a .Net assembly that can then be wrapped via a COM Callable Wrapper and called from Classic PowerBuilder.  The blog article uses Visual Studio and C# to create the assembly, but the assembly could also be created using PowerBuilder.Net.  The STMPClient.zip file in these PowerBuilder Samples on Google Drive is an example of doing just that.

Assigned Tags

      6 Comments
      Comments are closed.
      Author's profile photo Former Member
      Former Member

      Bruce,

      Always respect your knowledge and insights. For this topic your within the context of a controlled corporate environment? I mean you would not send emails directly accessing a customer's server if your software was sold commercially.

      Author's profile photo Bruce Armstrong
      Bruce Armstrong
      Blog Post Author

      I don't see the issue.  We have one commercial app where we use PBNISMTP.  We give the admin users (employees of the customer) a configuration screen where they enter the email configuration information for their servers.  They're sending email from the app to their users (mostly reports that we generate into Excel spreadsheets and then email).  Another commercial app uses the database package approach.  We have admin screens (once again used by customer employees) that enter the email configuration information that the app will use to send email to other customer employees).

      Author's profile photo Former Member
      Former Member

      Hi Bruce,

      We use mailsend, an open source command line tool which supports IPv6, with TopWiz's RunandWait to launch it.

      Thanks for the FAQ.

      Author's profile photo Former Member
      Former Member
      Author's profile photo Former Member
      Former Member

      We created a utility in C# and then were able to call that assembly from within PowerBuilder.

      Author's profile photo Former Member
      Former Member

      Hi Bruce,

      I download the Topwiz software EmailSMTP, but when I execute the example I have the next SendMailError message:

      An attempt was made to access a socket in a way forbidden by its acces permissions.

      I have in Settings an internal SMTP relay server with the port 25 and not require user an password.

      What I'm doing wrong?Settings.gif