Tuesday, January 21, 2014

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.


  • Many databases have build in features for sending email such as SQL Anywhere's xp_startsmtp / xp_sendmail, Oracle's UTL_SMTP or UTL_MAIL, Microsoft SQL Server's Database Mail, etc.  Therefore, it is quite feasible to create a stored procedure in the database that handles email transmission and simply have the PowerBuilder client invoke that.

No comments: