I met this error when I was configing my msmtp on Ubuntu Linux.

msmtp –account bh1scw -d -t < ~/patch/test.patch

1
2
3
4
...
ignoring system configuration file /etc/msmtprc: No such file or directory
loaded user configuration file /home/user/.msmtprc
sh: 1: /home/user/.mutt/oauth2.py: Permission denied

All file permission is right and finally I found that we should disable AppArmor

It works after install this package:

1
2
sudo apt install apparmor-utils
sudo aa-disable /etc/apparmor.d/usr.bin.msmtp