I have written a module that defines notification subscriptions. When a user subscribes, the notification is associated by subscription id (sid) with a company whose email address should be used as the 'From' address for the email that goes out.
I can perfectly happily defined my own tokens that for example put the company name in the email subject line. This is done by using the event id in the notifications_queue, to get the sid, and thus the company details.
The issue I'm having is that I can't do a token replace of the 'from' address because that's not available in the 'message keys' op of hook_messaging (or is it?) so I can't change it there. Secondly, I can change the 'From' address in hook_mail_alter(), but I can't see any way of working out the association to the company because I don't have any information about the notification in that function.
Do you know of a hook that gives me access to notification information at the point I can modify the 'from' address of the email that goes out?