Ubuntu – Mutt runng from Crontab

command linecronemailmutt

I have a bash script that is sending an email through command line mutt. This bash script is being called from a cron job (setup using crontab -e because of permissions needed to do all items in the script). I set the from address so that users can reply (which works fine), but the name being shown is "root". This is causing some confusion. Is there an actual way to set the name associated with the email address?

The email portion of the script is below:

EMAIL=me@domain.com
export EMAIL

mutt -s "subject" -a /home/user/directory/file*.xls -- user1@domain.com, user2@domain.com < /home/user/directory/message.txt

Thanks

Kevin

Best Answer

The easiest way to make sure the email that is sending with the correct name would be to run the cron job on the account you need it to send out:

Example

me@domain:~$ crontab -e

If you want the root user to send out the messages through mutt, try this one liner (it worked for me):

export EMAIL="Me <me@domain.com>" && mutt -s "subject" -a /home/user/directory/file*.xls -- user1@domain.com, user2@domain.com < /home/user/directory/message.txt

Hope this helps.

Related Question