//*********************************************************************

      //  Program.......: RPGMail

      //  Creation Date.: 2006-06-01

      //  Author........: Aaron Bartell

      //  Description...: RPG call Java method to send email.

      //*********************************************************************

     H dftactgrp(*no) thread(*serialize) bnddir('RPGMAIL')

 

      /copy qsource,RPGMailCp

      /copy qsource,ErrorCp

 

     D email           s               o   class(*java: RPGMail)

     D error           ds                  likeds(Error_Info)

      /Free

 

       monitor;

         RPGMail_init();

       on-error;

         error = Error_catch();

       endMon;

 

       monitor;

         email = RPGMail_new();

         RPGMail_addAddress(email: 'FROM': 'myname@mycompany.com': ' ');

         RPGMail_addAddress(email: 'TO': 'myname@mycompany.com': ' ');

         RPGMail_setSubject(email: 'iSeries RPGMail Test');

         RPGMail_setBodyText(email: 'My first rpg email app!': 'text/plain');

         RPGMail_setSMTPHost(email: 'smtp.mycompany.com');

         RPGMail_setSMTPPort(email: '25');

         RPGMail_send(email);

 

       on-error;

         error = Error_catch();

       endmon;

 

       *inlr = *on;

 

      /end-free