Email Utility Overview


In BBj 10.0 and higher, the Email Utility is an easy way to add the ability to send emails to any BBj application. The utility programmatically sends email messages, leaving the means by which the message is populated up to the programmer. The Email utility uses a user-specified outgoing mail server and email account, and supports attachments.

This utility, found at <bbj_install>/utils/email/Email.bbj, contains an example program and a BBj custom class that is a wrapper around Java’s JavaMail API for sending email.

In BBj 14.0 and higher, the EmailDialog class displays a dialog which allows users to send emails, add attachments, and maintain email settings and contacts

In BBj 16.0 and higher, the EmailDialog class can take advantage of the following global strings, either set via code or in a configuration file, to pre-populate the Settings dialog with the desired values. The Email class also adds a new constructor that does not require any parameters, using the values from the global strings instead.


Here are two examples:

  1) Setting the global string entry in code, before using the Email class:
      temp$ = STBL("BASIS_UTILITY_EMAIL_SERVER", "MyMailServer")

  2) Setting the global string entries in the config file, without changing any code:


  1. The BASIS_UTILITY_EMAIL_FROM parameter is only used with the EmailDialog class. You must call the setFrom() method when using the Email class.
  2. The values for the BASIS_UTILITY_EMAIL_SMTP parameter are either 'smtp' or 'smtps'. The value will be used as-is for the Email class, and will be translated into either a 0 or 1 for the EmailDialog's EmailServerSSL setting.

 For complete Email documentation, click here.