Applescript to download attachments in Airmail

Another option is SaneBox, who I have used for years and definitely recommend.

They have a feature called “SaneAttachments” which might come in very handy: