msmtp: cannot log to /var/log/msmtp.log: cannot open: Permission denied

Ubuntu 22.04

I had the same error message, and ultimately changing permissions, creating the log file, etc., didn't work. The problem in my case was caused by AppArmor: in my system, the file /etc/apparmor.d/usr.bin.msmtp only listed /var/log/msmtp as write permission in /var/log, so solution can be:

to use /var/log/msmtp as log in the configuration, instead of /var/log/msmtp.log

https://askubuntu.com/questions/878288/msmtp-cannot-write-to-var-log-msmtp-msmtp-log

/var/log/msmtp.log を /var/log/msmtp に変更する