Page 1 of 1

RPGMAIL emailing errors out

Posted: Mon May 08, 2023 1:51 pm
by pshankmd
Hello,
In a new API (part of apache server configuration), using RPGMAIL to send email.
When testing the API through POSTMAN, email process errors out with RNX0301 while calling RPGMailConstructor.

Any thoughts on why is it occurring or anyone came across this error and how to resolve it?

The error occurs in below module:
//--------------------------------------------------------------------------------------------
// @Author: Aaron Bartell
// @Created: 07/07/2003
// @Descr: This will create a new RPGMail Java object by calling the RPGMail
// constructor.
// @Usage: RPGMail_new()
//--------------------------------------------------------------------------------------------
P RPGMail_new b export
D RPGMail_new pi o class(*java: RPGMail)

D error ds likeds(Error_Info) inz
/free

monitor;
return RPGMailConstructor();
on-error *All;
error = Error_catch();
Error_throw(
'RPGMAIL101': 100: 'RPGMail_new': error.code + ': ' + error.text);
endmon;

/end-free
P e

Adding error details below from joblog:

Java exception received when calling Java method.
*******RPGMAIL101███À██RPGMail_new ██RNX0301 :

Additional Message Information

Message ID . . . . . . : RNX0301 Severity . . . . . . . : 50
Message type . . . . . : Escape
Date sent . . . . . . : 05/08/23 Time sent . . . . . . : 08:44:49

Message . . . . : Java exception received when calling Java method.
Cause . . . . . : RPG procedure RPGMAIL_NE in program RPGMAIL/RPGMAILSV
received Java exception "java.lang.NoClassDefFoundError:
com.mowyourlawn.rpgmail.RPGMail" when calling method "<init>" with signature
"()V" in class "com.mowyourlawn.rpgmail.RPGMail".
Recovery . . . : Contact the person responsible for program maintenance to
determine the cause of the problem.
Technical description . . . . . . . . : If the exception indicates that the
Java class was not found, ensure the class for the method is in the class
path. If the exception indicates that the Java method was not found, check
the method name and signature. If the signature is not correct, change the
RPG prototype for the method, or change the Java method, so that the return
type and parameter types match. You can determine the signatures for all the
methods in class XYZ using command QSH CMD('javap -s XYZ').

Thank you!

Re: RPGMAIL emailing errors out

Posted: Mon May 08, 2023 2:50 pm
by jonboy49
RPGMail is horribly out of date so I'm not surprised given the changes in Java over the years that it is not working.

In fact the author of the tool said this some 6+ years ago!

"I wrote RPGMail. The fix that's worked for others is to alter the ENVVAR
to point at a version of Java on your system.

A better fix is to buy MAILTOOL from BVSTools.com. $284/yr 100% RPG.

Aaron Bartell"

I would add to that the suggestion that you also consider using MMAIL (from Easy400.net) or do like we do and use PHPMailer connected to our RPG programs.

Re: RPGMAIL emailing errors out

Posted: Mon May 08, 2023 7:43 pm
by Scott Klement
I've never used RPGMail (never understood the appeal of calling Java to do something as simple as sending email, for which there are dozens of other solutions).

But the error you're receiving is "java.lang.NoClassDefFoundError: com.mowyourlawn.rpgmail.RPGMail"

That simply means it can't find the RPGMail class in your CLASSPATH.

Re: RPGMAIL emailing errors out

Posted: Mon May 08, 2023 10:01 pm
by pshankmd
Thanks jonboy49, will look into your suggestion on getting a different tool, if this could not be resolved.

Thanks Scott. Would you know how to make the RPGMail class available in classpath. Have not done it before.

Re: RPGMAIL emailing errors out

Posted: Mon May 08, 2023 10:36 pm
by jonboy49
Scott is right in that the CLASSPATH is likely your problem. Even if you can resolve it for now it may well be a short-lived victory!

There's some trouble-shooting help here in a presentation that Aaron did many moons ago. https://docplayer.net/53302853-Rpgmail- ... -2011.html

But understand that this was written for V5R1 - and it is 18 years since that went out of service. It was built on a very old version of Java which may present its own problems.

Re: RPGMAIL emailing errors out

Posted: Tue May 09, 2023 9:59 pm
by pshankmd
Thanks jonboy49 for your assistance. Looks like we need to find a better alternative of RPGMAIL.
Will check on that.

Re: RPGMAIL emailing errors out

Posted: Fri Aug 18, 2023 9:48 am
by KlausVogel
Currently, we are using RPGMAIl for many years and it seems everything works fine.
I have just one issue:
Do you know why rpgmail reply no error if I enter a wrong domain name, like klaus@gmailxx.de?

I tried to use the IBM command as an alternative, but it seems too difficult and e.g. if I enter a wrong email address (before the @ sign), I receive no error.
BR, Klaus