× 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.



RPGMail_addAddress should be called for each "To" address.  The addresses
could be in an array, PF, etc, and you would just loop around the repeating
structure to call RPGMail_addAddress multiple times.
 
I am thinking of upgrading the RPGMail tooling to operate similar to my
latest tool the RPG Chart Engine.  This will create a single Java instance
running in a background batch job listening to a data queue waiting for
emails to send.  Don't know when I will get time to do it though :-)
 
Hope that helps,
Aaron Bartell
http://mowyourlawn.com

 
  _____  

From: Mike [mailto:koldark@xxxxxxxxx] 
Sent: Wednesday, December 27, 2006 9:24 AM
To: Java Programming on and around the iSeries / AS400
Cc: Aaron Bartell
Subject: RPGMail/JavaMail Issues


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  


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.