IBM Support

Using mail.addMessage with the Mailbox Connector

Question & Answer


Question

The Mailbox Connector has the 5 modes of operation. In the AddOnly mode, the new Messages are delivered to the connector in an attribute called mail.addMessage; this attribute is passed an Object of type javax.mail.Message or an array of that type.

Cause

If the 'mail.addMessage' is malformed, the following error can occur:
CTGDJN024E Message in Attribute 'mail.addMessage' is not in appropriate format.

Answer

This is a working example of the 'mail.addMessage' attribute to add a message to a gmail account.
// mail.addMessage script
var from = "";
var to = "";

var props = new Packages.java.util.Properties();

//GMail via TLS
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");

/*
//GMail via SSL
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
*/

var session = Packages.javax.mail.Session.getDefaultInstance(props);
var message = new Packages.javax.mail.internet.MimeMessage(session);

message.setFrom(new javax.mail.internet.InternetAddress(from));
message.addRecipient(javax.mail.Message.RecipientType.TO, new
javax.mail.internet.InternetAddress(to));
message.setSubject("Message Create by IBM TDI");
message.setText("Hello World");
ret.value = message;


http://docs.oracle.com/javaee/6/api/javax/mail/Message.RecipientType.html
http://docs.oracle.com/javaee/6/api/javax/mail/internet/InternetAddress.html

[{"Product":{"code":"SSCQGF","label":"Tivoli Directory Integrator"},"Business Unit":{"code":"BU008","label":"Security"},"Component":"General","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.0;7.1;7.1.1","Edition":"All Editions","Line of Business":{"code":"LOB24","label":"Security Software"}}]

Document Information

Modified date:
22 June 2018

UID

swg21605980