× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Here's how I did it - stolen from Aaron's RPGMail program:

 For i = 1 to RecipAddrDS.NbrFiles;
    Clear Parm1;
    Clear Parm2;
    Clear Parm3;
    Parm1 = 'TO';
    Parm2 = RecipAddrDS.RecipAddr(i);
    If i > RecipNameDS.NbrFiles;
      Parm3 = RecipAddrDS.RecipAddr(i);
    Else;
      Parm3 = RecipNameDS.RecipName(i);
    EndIf;
    RPGMail_addAddress(email: %Trim(Parm1):
                              %Trim(Parm2):
                              %Trim(Parm3));
 Endfor;

RecipAddrDS is the data structure containing recipient addresses and
NbrFiles is a field identifying the number of entries. It comes from the
command.



On 12/27/06, Mike <koldark@xxxxxxxxx> wrote:

Hey, working with RPGMail in an interactive program. An email gets sent
after a task has been added to alert the next person to take action. The
problem is that the first time a person runs the program, it takes quite a
while for the JVM to start up thus makes the screen look like it freezes.
To
fix the problem, I wrote a wrapper that then submitted the email portion
to
batch. Now I am running into a problem where they want to send the email
to
multiple people (imagine that). I have tried unsuccessfully to place all
of
the addresses into a single "TO" address. I have used the semi-colon, a
comma, and a space to separate the addresses.

Short of writing a parser to break apart the addresses, is there a way to
pass multiple addresses to a "TO" field?

Here is my wrapper code:

     P*--------------------------------------------------
     P* Procedure name: SendEmail
     P* Purpose:        Send Email at Real-Time
     P* Returns:        Was the Email Successful?
     P* Parameter:      fromAddress
     P* Parameter:      toAddress
     P* Parameter:      ccAddress
     P* Parameter:      subject
     P* Parameter:      body
     P*--------------------------------------------------
     P SendEmail       B                   EXPORT
     D SendEmail       PI              N
     D  fromAddress                 100A   CONST
     D  toAddress                 32767A   CONST
     D  ccAddress                 32767A   CONST
     D  bccAddress                32767A   CONST
     D  subject                   32767A   CONST
     D  body                      32767A   CONST

      /free

         // Setup the JVM
         monitor;
           RPGMail_init();
         on-error;
           rpgMailError = Error_catch();
           return *OFF;
         endmon;

         monitor;

           // Create a new object
           rpgMailObject = RPGMail_new();

           // From Address
           RPGMail_addAddress(rpgMailObject:'FROM':
                              %trim(fromAddress):' ');
           // To address
           RPGMail_addAddress(rpgMailObject:'TO':
                              %trim(toAddress):' ');

           // Carbon Copy
           if ccAddress <> ' ';
             RPGMail_addAddress(rpgMailObject:'CC':
                                %trim(ccAddress):' ');
           endif;

           // Blind Carbon Copy
           if bccAddress <> ' ';
             RPGMail_addAddress(rpgMailObject:'BCC':
                                %trim(bccAddress):' ');
           endif;

           // Subject
           RPGMail_setSubject(rpgMailObject:%trim(subject));

           // Email Body
           RPGMail_setBodyText(rpgMailObject:%trim(body):'text/plain');

           // Set the SMTP server information
           RPGMail_setSMTPHost(rpgMailObject:'192.168.50.250');
           RPGMail_setSMTPPort(rpgMailObject:'25');

           // Send the Email
           RPGMail_send(rpgMailObject);

         on-error;

           rpgMailError = Error_catch();
           return *OFF;

         endmon;

         return *ON;

      /end-free
     P SendEmail       E

--
Mike Wills
Blog - http://mikewills.name
Podcasts - http://theriverbendpodcast.com

"Indicators are like Atomic Bombs. Handy to have but you should never use
them unless you have too." - Anonymous
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.