how to add multiple emails in CC while sending email in Maximo

1.1k views Asked by At

We are using maximo 6.2.3 version. To send emails for a particular requirement we are using sendemail method in Mxserver class(psdi/server/Mxserver.class).

sendEMail(String to, String from, String subject, String message)

In mxserver class there is a also a method, where I can add multiple email addresses in TO .

sendEMail(String to[], String from, String subject, String message)

Method in mxserver class for adding one email address in TO and one cc

sendEMail(String to, String cc, String bcc, String from, String subject, String message)

My requirement is to add one email address in TO and multiple email addresses in CC. How I can I do that?

Thanks in advance

1

There are 1 answers

0
Arun PM On

I use it the following way and it works fine.

if(commSetRemote.count() > 0)
        {
            CommTemplate commRemote = (CommTemplate)commSetRemote.getMbo(0);
            SqlFormat sqf = new SqlFormat(getRoot(), commRemote.getString("subject"));
            sqf.setIgnoreUnresolved(true);
            String subject = sqf.resolveContent();
            sqf = new SqlFormat(this, commRemote.getString("message"));
            sqf.setIgnoreUnresolved(true);
            String message = sqf.resolveContent();
            if (message.length() > 0){
                message = message + "";
            }
            String emailList ((CommTemplateRemote)commRemote).convertSendTo("COMMTMPLT_TO", this);
            String sendTo = emailList;

            emailList = ((CommTemplateRemote)commRemote).convertSendTo("COMMTMPLT_CC", this);
            String cc = emailList;

            emailList = ((CommTemplateRemote)commRemote).convertSendTo("COMMTMPLT_BCC", this);
            String bcc = emailList;
            String sendFrom = commRemote.getString("SENDFROM");
            try {
                MXServer.sendEMail(sendTo, cc, bcc, sendFrom,subject, message, sendFrom, null, null);
            } catch (MessagingException e) {
                e.printStackTrace();
            }
        }