Hi there !
In case of, I faced the same problem after upgrading to Moodle 3.9.1 (on my local instance)
I used 'Adaptable' theme (which is not maintained) but switching to 'Boost' didn't solve the problem for me.
But after looking at my Nginx logs i saw that 'Clamav' antivirus plugin was trying to send mail although I didn't installed it.
So I went to Site administration > Plugins > Antivirus plugins and disabled 'ClamAV antivirus' (I didn't need it for dev)
After that Upload form worked correctly .