Script to define notification recipient

Hello,

I have a use-case where I need to send an e-mail notification to a recipient whose SMTP address is stored in a virtual attribute. That recipient may even be external to the organisation. Unfortunately, however, there is no option to dynamically determine the recipient in code at runtime, as far as I can tell.

If anyone has ever found a way to achieve something like this, I would be much obliged!

Thanks!