Enterprise Manager logoEnterprise Manager: Email Services

Description

In BBj 17.00 and higher, Email Services, found in BBjServices, is for configuring outgoing Simple Mail Transfer Protocol (SMTP) clients. An email service allows users to send emails from BBj or Java programs using the Admin API or Event Handler notifications.

Button Action
Configure a new email service
Remove selected email service(s)
Refresh the email services list

Configuration

Open the email client of choice and navigate to the section where the user configures outgoing mail settings. This varies by client, but is often under “Account Settings,” “Preferences,” or similar. Use this information to configure the email service.

Service Name

The service name is displayed in the email services list and the Admin API selects a specific email service using this field.

Server

SMTP Server Address: The hostname or IP address of the mail server (e.g., smtp.example.com).

Port

Common ports are 25, 465, and 587. The different ports are usually associated with the authentication types:

  • 25: Typically used without encryption
  • 465: Typically used with SSL
  • 587: Typically used with TLS

User and Password

Enter login credentials for connecting to the SMTP mail server.

Default From and Default Reply-To

Default email addresses for the “From” and “Reply-To” fields respectively of emails sent through this email service.

Authentication

There are three different types, choose the one required by your mail server provider.

  1. None (not recommended)
  2. Transport Layer Security (TLS)
  3. Secure Socket Layer (SSL)

Example Configurations

Gmail

  • Server: smtp.gmail.com
  • Port: 465 or 587
  • User: your full Gmail address (e.g., example@gmail.com)
  • Password: your Gmail password
  • Authentication: SSL/TLS

Outlook/Hotmail

  • Server: smtp-mail.outlook.com
  • Port: 587
  • User: your full Outlook.com/Hotmail address (e.g., example@outlook.com)
  • Password: your Outlook.com/Hotmail password
  • Authentication: TLS

Yahoo Mail

  • Server: smtp.mail.yahoo.com
  • Port: 465 or 587
  • User: your full Yahoo email address (e.g., example@yahoo.com)
  • Password: your Yahoo email password
  • Authentication: SSL/TLS

iCloud Mail

  • Server: smtp.mail.me.com
  • Port: 587
  • User: your full iCloud email address (e.g., example@me.com)
  • Password: your iCloud email password
  • Authentication: TLS

Remarks

A user can verify that their Email Service has been configured properly by clicking the [Send Test Message] button to send a message to an email of their choice. If the test fails, the user can adjust the configurations as needed.

Admin API

BBjAdminBase.newEmailService creates a new BBjAdminEmailService object, which is used to configure an email service and send emails using BBjAdminEmailMessage. Alternatively, the user can get a list of email services on the server with BBjAdminBase.getEmailServices or specify an existing email service by its service name with BBjAdminBase.getEmailService.

Admin API Example

use com.basis.api.admin.BBjAdminEmailService
use com.basis.api.admin.BBjAdminEmailMessage

declare BBjAdminBase api!
declare BBjAdminList emailServices!
declare BBjAdminEmailService emailSvc!
declare BBjAdminEmailService selectedEmailSvc!
declare BBjAdminEmailMessage msg!

api! = BBjAdminFactory.getBBjAdmin("admin", "admin123")

promptForService:
emailServices! = api!.getEmailServices()
print "Select a service to use to send a message:"
for i = 1 to emailServices!.size()
    emailSvc! = cast(BBjAdminEmailService, emailServices!.get(i - 1))
    print str(i) + ") " + emailSvc!.getString(BBjAdminEmailService.NAME)
next i
input "Enter Choice #: ", choice
selectedEmailSvc! = cast(BBjAdminEmailService, emailServices!.get(choice - 1))

print "Enter recipient (comma separate multiple): "
input recipient$

print "Enter the subject of the message:"
input subject$

print "Enter short message: "
input message$

msg! = selectedEmailSvc!.createMessage()
msg!.setString(BBjAdminEmailMessage.TO, recipient$)
msg!.setString(BBjAdminEmailMessage.SUBJECT, subject$)
msg!.setString(BBjAdminEmailMessage.TEXT, message$)
selectedEmailSvc!.sendMessage(msg!)
print "Your message was successfully sent!"
print "***********************"
goto promptForService