The interesting part of this script for me is the $$ - this special script variable is the process ID (PID) of the currently running script, so it makes a temporary file called winmail_<current process id>.dat. Other than that it's pretty similar to my original script apart from opening Nautilus at the end.

Now it's even easier to open and extract files from winmail.dat files!