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:
HOME='/'
However the email headers contain this:
X-Cron-Env: <HOME=/home/username>
which is correct. So why is $HOME unset for the esmtp?
sudoor something else that resets your environment? Have you considered usingenvto set the home directory explicitly for thesendmailprocess? – Daniel Beck Jul 27 '11 at 11:11