I have developed a set of RPG sub procedures that utilize the JavaMail API's from Sun to send emails with ease from your iSeries RPG program without limitations on the amount of addresses or attachments that can be used within the email.

Here you will find an RPG service program that I have been working on that interfaces with the JavaMail API's from Sun. The interfaces are pretty darn straight forward and restriction-less (is that a word?). You can send as many attachments as you like or send to as many people as you wish. If you have any questions email me at aaronbartell@mowyourlawn.com.

Q:I am getting the following error when I try to send an email:
Message . . . . : Java exception received when calling Java method.

Cause . . . . . : RPG procedure RPGMAIL_SE in program RPGMAIL/RPGMAILSV
received Java exception "java.lang.NoSuchMethodError: append
(Ljava/lang/StringBuffer;)Ljava/lang/StringBuffer;" when calling method
"send" with signature "()V" in class "com.mowyourlawn.rpgmail.RPGMail".

A:This means that a previous JDK is being chosen to run the code (most likely JDK 1.3) and you need to tell the iSeries that you instead want to use JDK1.4. To do this you need to create the following file in the IFS: /QIBM/UserData/Java400/SystemDefault.properties

Once it has been created, open it and place the following line of text in it:

Save the file and exit. Sign off and back on again. Re-run your RPGMail program.

Q:How do I send an html email?:

A: There are two ways you can do an html email (much like there are two ways to send plain text emails) The first is to fill the body of the email with data from an RPG variable:
RPGMail_setBodyText(email: 'My first <br>rpg</b> email app!': 'text/html');

The other way is to specify an IFS file as the content of the email body:
RPGMail_setBodyFile(email: '/home/aaron/orderstatus123.xml': 'text/html');

Q:How do I add attachments?:

A:RPGMail_addFileAttachment(email: '/ifsfolder/myfile.txt': 'My File.txt': 'text/plain');
RPGMail_addFileAttachment(email: '/ifsfolder/myfile.pdf': 'My Order.pdf': 'application/pdf');
RPGMail_addFileAttachment(email: '/ifsfolder/myfile.html': 'My Order.html': 'text/html');
You can just keep adding and adding and adding.




RPG Mail Example
RPG Mail v2.3 Zip File (Last Update: 2007-07-21)
IBM Systems Magazine article about RPGMail


Need more features or faster processing? Check out RPGMail Enterprise at www.SoftwareSavesLives.com.

copyright ©2006 | developed by Krengel Technology, Inc.