Can not use sendmail for email notification

I am running Gitea on Ubuntu 16.04 and trying to enable email notification. In app.ini I configured it to use sendmail by setting the mailer section as

ENABLED       = true
FROM          =
MAILER_TYPE   = sendmail
SENDMAIL_PATH = /usr/sbin/sendmail

But when I clicked on the “Send Testing Email” on the Site Administration > Configuration page, I got the following error message:

Failed to send a testing email to '': gomail: could not send email 1: fork/exec /usr/sbin/sendmail: no such file or directory

I’ve verified that /usr/sbin/sendmail exists and is working fine. Does anyone have suggestion on what might have caused this error?

Same error happens with Ubuntu 22.04 and latest Gitea 1.21.1 from snap. Why?

Does the git user has permission to invoke sendmail?