I faced with the same problem when develop my own payment module. As I understand it, to use the KKAppEng in payment gateway callback action, are required to log into the system and get an sessionId. This is done in module by calling sessionId = kkAppEng.getEng().login(username, password);. This sessionId is used directly in subsequent calls to the engine. But when payment module calling sending email method sendOrderConfirmationMail(kkAppEng, orderId, /* success */true), the sessionId don't passed directly in method call. Apparently, to get the sessionId, somewhere in the implementation of the method used kkAppEng.getSessionId(), but after call login method, sessionId is absent in kkAppEng! So, in my module after sessionId = kkAppEng.getEng().login(username, password);i just put this line
kkAppEng.setSessionId(sessionId);and then sending email processing is succeful