Applescript to get email link not working

FWIW, I think I might have been the one to send @MacSparky the script referenced by the OP. When I upgraded to Monterey, I had to change the Python bits to use Python 3. The updated script is as follows:

[Redaced, use this script instead]