I am using esmtp to send email as an output of cron job. The SMTP server and credentials configuration are stored under my $HOME/.esmtprc. However it looks like the $HOME env variable is set to '/', rather than to HOME from /etc/passwd as the manual suggests. I changed /usr/sbin/sendmail to output environment variables to file and I see this:
However the email headers contain this:
which is correct. So why is $HOME unset for the esmtp?