We have seen issues like this for EmailListener but I don't recall such a problem with sendemailnotification. Regardless, Tracer is your friend and you can turn debug on sendemailmessage RUF/RUL for javamail debug.
So: using SMA, you can switch on DEBUG logging for the library which contains this Function (The Library is called 'Default' - which can be seen on the Rule Form for the Function):
The logger is called 'com.pegarules.generated.pega_integrationengine_default' - switch this to DEBUG.
Now: here's the other issue - the DEBUG output for the JavaMail API goes to 'standardout' : so you need to know where your particular App Server redirects this information - as that it where you'll need to look for the DEBUG output.
If you are on Tomcat - I have never been able to work out where this information goes - so I have taken a different approach.
If you are in this position of using Tomcat - and you can't find where it puts it's standard-out (and if you DO find this out , please let us know how and where you found it !); then you can do the following:
A. Create your own Function Rule:
1. Create your OWN Function Library ('MyDiagnostic' or something).
2. Create your OWN Function in this library called SendEmailMessage (not strictly necessary to have the same name as the original, but why not).
3. Copy the existing OOTB SendEmailMessage Java code into your function.
4. At the top of the pasted code, add in a 'oLog.infoForced("diagnostic called");' - just something that will appear in your PegaRules.log to prove you are picking up the right function when you come to test it.
4. Save your Function, Build the Library - make sure there are no errors.
B. Perform a Private CheckOut of the OOTB Activity - reference your function
1. Perform a Private Checkout of the calling Activity SendEmailNotification.
2. Change the Java Step (it's step 6 in the PRPC717 version) to reference YOUR function library/function.
C. Test it.
1. Just perform your test as before: confirm you see the DEBUG logging you added into your Function.
D. Modify your Function to 'catpure' the log.
This is tricky part: you might find that you have to edit this code below in order to get it to 'fit' your PRPC Version.
This works for 717 (but of course that is the one version you do NOT need to debug !):
The code does the following :
It creates an 'OutputStream' which just captures anything sent to it into a StringBuilder.
We then re-direct the Java Mail API to use this 'OutputStream'; this is done by modifying the existing code to do this: