Sunday, April 28, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 8850  / 2 Years ago, fri, may 13, 2022, 5:06:26

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 protected]
export EMAIL

mutt -s "subject" -a /home/user/directory/file*.xls -- [email protected], [email protected] < /home/user/directory/message.txt


Thanks



Kevin


More From » command-line

 Answers
4

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 <[email protected]>" && mutt -s "subject" -a /home/user/directory/file*.xls -- [email protected], [email protected] < /home/user/directory/message.txt



Hope this helps.


[#38331] Saturday, May 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
peafowkes

Total Points: 356
Total Questions: 102
Total Answers: 117

Location: Lebanon
Member since Tue, Oct 12, 2021
3 Years ago
peafowkes questions
;