Thank you for your detailed reply.
I had done debugging for step 1:
- The replyaddress is not being generated; and/or
The replyaddress is being generated and is printed out in the cron job.
It looks like there is an issue with reply-to address not being set as an header through eventdata object. I saw your reply on this other post about this: https://moodle.org/mod/forum/discuss.php?d=277594
If I set the reply-to address to the $userfrom->customheaders, everything works. Somehow, the replytoaddress from $eventdata is not being added to the header by the Message API.
I am going to debug this over the weekend with the steps you mentioned and post my findings on this post: https://moodle.org/mod/forum/discuss.php?d=277594 . Since its the same issue on two different posts, lets move our conversation to the official post mentioned "https://moodle.org/mod/forum/discuss.php?d=277594" in the docs for the sake of others finding this conversation.