Instructions for implementing the JavaMail API with RPG

Change list

9/12/2002 - Allowing you to send up to 8 attachments in one message. Why 8? Because that's all I can get to work. I get compile errors in JavaMailwithAttachment.java when I try to add the ninth. Don't laugh too hard at what I've done here, I barely know any Java right now. And I know I could have probably done a better job implementing this, but I had to get this up and running immediately for my company, so this is rough and ready for the time being.

9/12/2002 - Stripping the path information from the attachment's file name, which seemed to upset one of my customers. Again, don't laugh too hard. I'm sure I can do this better with a simple loop, but I needed to get this up and going quickly.

9/12/2002 - No longer naming the multipart, which seemed to give Lotus Domino R5 webmail some trouble (the attachment would not show up).

9/12/2002 - Checking all of the filenames passed into the javamail RPGLE program to make sure they are filled in and passing blanks if they are not. And I know, this program currently takes 30 filename parms. I am hoping to at some point figure out how to get the JavaMailwithAttachment.class to compile with more than 8 filename parms. Just ignore the other 22 for right now.

9/12/2002 - Changed the prototype file so it matches the javamail RPGLE program and the JavaMailwithAttachment.class

Remember, this only works with V5R1 or higher

1. Install the latest JV1 group PTF's. This will not work with the JV1 group as installed from the V5R1 CD's (I know this from experience).

2. Create a directory called JavaUtil in the root of the IFS.

3. Create a directory called JavaMail in the JavaUtil directory.

4. Move the following files to /JavaUtil/JavaMail :

Note: .class and .jar files are binary files. If you are using FTP to move the files, be sure you use BINARY. Download these files here (580 KB).

5. Move javamailpr.mbr to a source physical file member.

6. Move javamail.mbr to a source physical file member and compile it (RPGLE). Be sure to point the /copy to the correct source file.

7. Move cjavamail.mbr to a source physical file member and compile it (RPGLE).

8. Move clsmail.mbr to a source physical file member and compile it (CLP).

9. Move strmail.mbr to a source physical file member and compile it (CLP).

10. In JavaMail.properties, change email.hosttype to the type of host you use. Change email.hostname to the name or IP address of your SMTP server.

11. To test, call strmail, then cjavamail, then clsmail.