msmtp permission denied errors: disable apparmor!

2020-08-15

If you see "permission denied" errors with msmtp, please disable AppArmor to see if this fixes the problem: sudo aa-disable /etc/apparmor.d/usr.bin.msmtp
More information: unfortunately Debian and Ubuntu provide an AppArmor profile for msmtp that frequently breaks functionality, and in ways that are very hard to debug. Until they fix that profile, I can only recommend disabling it whenever you see a "permission denied" error that has no apparent reason.
The latest example affects OAUTH2 authentication. Thanks to Github user marcelolaia for figuring this out!