Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 07-26-2007, 09:24 AM   #1
Registered: Mar 2007
Posts: 109

Rep: Reputation: 15
mutt + changing senders email address


I have a cron job that runs a script and emails the result , but the problem is that the sender's email address is root and i want to change it to, i can always set the cron to run as a user but it gives me permission problems . i am using the mutt mail client , i googled around and they asked me to set the options in the .muttrc file but i cannot find that file.
Is there an option on mutt to chane the senders email address?????????????????/

Kind Regards
Old 07-26-2007, 10:12 AM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 613Reputation: 613Reputation: 613Reputation: 613Reputation: 613Reputation: 613
.muttrc is in the user's home directory. If it's not there, create it.
Old 07-27-2007, 02:39 AM   #3
Registered: Mar 2007
Posts: 109

Original Poster
Rep: Reputation: 15
i have created the .muttrc in roots home directory and gave the option

set from = ""

but still when i run mutt it gives me the senders address
now what???

Thanks for the reply
Old 07-27-2007, 06:54 AM   #4
Registered: Mar 2007
Posts: 109

Original Poster
Rep: Reputation: 15

to change the from email address while using mutt
create a .muttrc in the users home directory if it doesnot exist, then enter the feild

set realname="username" this will change the name in the senders name .
Old 05-11-2011, 08:27 PM   #5
LQ Newbie
Registered: May 2011
Posts: 1

Rep: Reputation: 0
or you can just simply have an entry

set from="Name <>"

in your .muttrc file. No need for an additional realname entry
Old 07-20-2011, 12:34 PM   #6
Senior Member
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,300

Rep: Reputation: 102Reputation: 102
This can be done as below -

export EMAIL=sender@domain && mutt -a /path/to/attachment -s "Subject" < /dev/null
Old 04-04-2012, 04:03 AM   #7
LQ Newbie
Registered: Jun 2006
Distribution: OpenSuSe
Posts: 5

Rep: Reputation: 0
I need some help related to this topic if anyone is still monitoring this thread. My problem is similar to this and in googling for information came upon this thread.

I have a shell script that sends a simple email from user root. The aim is to eventually use this mechanism for sending health check information from the machine. The domain the machine resides is not externally known; ie it is on an internal LAN. For example say its hostname is Without setting the EMAIL environment variable mutt sends the email to a local SMTPD server for forwarding as This causes the final mail system to reject the mail (rules to stop spamming etc) because it can not resolve the domain

So in the script I coded 'export EMAIL=""' and when run in the foreground in a bash interactive shell the email is accepted by the final mail system and it is received correctly.
However if I run this same script under CRON it is as though mutt ignores the EMAIL environment variable and sends the email as though it is from

The script looks like this:
export EMAIL=""
SUBJECT="$(hostname) test"
mutt -s "${SUBJECT} ${EMAILTO} </tmp/message.txt

BTW my ~/.muttrc for root looks like this (but does not appear to make any difference if I have the -f or not for sendmail)
set sendmail="/usr/sbin/sendmail -oem -oi"

It appears, to me, that mutt ignores the EMAIL environment variable when it is invoked from a shell that is not interactive. Has anyone else seen this behaviour? Could this be an anti-spamming mechanism?

Old 11-21-2012, 11:20 AM   #8
LQ Newbie
Registered: Nov 2012
Location: Riga, Latvia
Distribution: Ubuntu Precise Pangolin
Posts: 1

Rep: Reputation: Disabled
Talking IF someone is still monitoring

Originally Posted by paklan
However if I run this same script under CRON it is as though mutt ignores the EMAIL environment variable and sends the email as though it is from
Know nothing about cron, however i noticed that if you set in /etc/Muttrc file these setings:
set realname="Ashok Kumar"
set from="Ashok.Kumar@unknown.domain"
set use_from=yes
And even if "set use_from" is set to "no" default name will override environment variable, so i commented these lines and everything work fine in script.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sendmail outbound relaying based on senders address dbnor Linux - Networking 2 01-27-2007 09:44 AM
Using mutt for two different email accounts spydrmn Linux - General 2 03-08-2005 07:16 AM
Configuring necessary items so MUTT can send email nigma Linux - Networking 0 01-17-2005 12:07 PM
send email with mutt on command line naijaguy Linux - General 1 12-29-2004 06:33 PM
Sendmail --> Blocking email from senders ForumKid Linux - General 2 10-25-2002 02:46 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration