Hi all,
I am implementing a Background Callable Object for sending customized e-mail. This would have following features which are currently not possible in Standard Backgrnd Send Mail COs :-
1. Subject is customized one
2. CC and BCC available.
I have got following code for sending email through Java DC:-
public void postMail( String recipients[ ], String subject,
String message , String from) throws MessagingException
{
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", SMTP_HOST_NAME);
Session session = Session.getDefaultInstance(props);
session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
{
addressTo<i> = new InternetAddress(recipients<i>);
}
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
}
Now I have following question.
How do I read GP config *SMTP server* and *Sender E-Mail* params within a backgrnd CO programmatically ?? These two params I saw at following location:--
Guided Procedure Administration --> GP Config Tools --> Interactive Forms
Because, the same code may run on different servers right from Dev --> Testing --> Production. All three servers may have different SMTP hostname and senders.
Kindly share your ideas on this.
Thanks and regards,
Amey Mogare