Sending Email With Attachments From Unix / Linux Command [ Shell Prompt ]

by on August 13, 2004 · 99 comments· LAST UPDATED April 17, 2012

in , ,

If you need to send an email with a text file (or binary file) as attachment using shell script or command prompt in Unix or Linux; try mutt - a terminal-based e-mail client for Unix-like systems.

Mutt is a small but very powerful text based program for reading electronic mail under UNIX /Linux operating systems, including support for color terminals, MIME, and a threaded sorting mode.

Please note that mutt is a pure MUA and cannot send e-mail without proper email server . You need a working Mail Transfer Agent (MTA) such as sendmail or postfix. I am assuming that you have a working email server in your office.

How do I install mutt email client?

If mutt is not installed, use the apt-get or yum or up2date commands as follows (you must login as a root user). Debian / Ubuntu Linux user type the following command to install mutt client:
# apt-get install mutt
Fedora / CentOS or Red Hat Enterprise Linux (RHEL) user type following command to install mutt:
# yum install mutt
OR (RHEL version <= 4 )
# up2date mutt
FreeBSD user type the following command to install mutt via pkg_add command:
# pkg_add -v -r mutt

How do I send email attachments from a command prompt?

Use mutt command as follows to send an email with attachment:
$ mutt -s "Test mail" -a /tmp/file.tar.gz you@cyberciti.biz < /tmp/mailmessage.txt
Where,

  • you@cyberciti.biz - is the recipient.
  • /tmp/mailmessage.txt - is the main body of the e-mail (read message from the file "mailmessage.txt").
  • -a /tmp/file.tar.gz - is an attachment.
  • -s "Test mail" - is a subject line.

If you don't have mutt command installed, try uuencode command to send emails with attachments.

See also:

Page last updated at 12:33 AM, April 18, 2012.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 99 comments… read them below or add one }

1 Anonymous November 2, 2004 at 10:22 am

I didnt recieve any mail in my yahoo inbox when i tried to send the message from the command line using mutt
mutt -s “testmail” anugula_kiran@yahoo.co.in > /tmp/k
please i am eager to know about it

Reply

2 Julio Virea May 1, 2011 at 6:35 pm

Check your bulk mail. I am using it and my emails when are sent out of the computer goes in the “from: www-data” so yahoo take the email as spam and if your settings in yahoo.com is to delete all spam then is deleting it. Try using another email a POP account. It will work like charm.

Reply

3 nixcraft November 18, 2004 at 5:36 pm

May be yahoo is blocking your email! It should work. If you are on PPP then it is high possiblity!


Vivek Gite

Reply

4 Anonymous April 10, 2005 at 11:23 pm

I can’t be sure, but it looks like you’re using the wrong directional switch. In your command use, you have “>”. I’m presuming you’re attempting to send the message in the file /tmp/k which means you should probably be using the “

Reply

5 nixcraft April 11, 2005 at 2:18 pm

In the command:

mutt -s “Test mail” -a /tmp/file.tar.gz vivek@nixcraft.co.in

Reply

6 Anonymous July 23, 2005 at 2:23 pm

Hey i was hunting 4 this info and found it via yahoo. This is easy than those crazy scripts… thx for good info in this blog.

Reply

7 tony jr. July 24, 2005 at 6:03 pm

thanks this blog is bookmarked now.

Reply

8 Anonymous August 19, 2005 at 3:51 am

thanks, you made my day (or better, tomorow ) with this hint…

Reply

9 Anonymous November 19, 2005 at 12:52 am

nice post worth to bookmark :)

Reply

10 ebasi December 19, 2006 at 8:25 am

thanks for this post!

Reply

11 Hagel April 28, 2007 at 12:00 am

How do I use MUTT to send multiple attachments in a single email?

Reply

12 dinine November 5, 2013 at 10:18 am

I don’t think you’re still looking for the answer but it may help others…
So just separate emails with comma
mutt -s “your_subject” toto@titi.com,tita@titi.com < your_body.txt

Reply

13 MickZA May 23, 2007 at 8:57 am

Multiple attachments use -a for each ie:

mutt -s “Test Mail” -a attach1 -a attach2 -a attach3 vivek@nixcraft.co.in

Reply

14 AJS June 6, 2007 at 7:50 pm

Nice post thanks guys!

Reply

15 kumaryadav July 31, 2007 at 3:57 pm

I just want learn more things in linux,

Reply

16 Sergani June 21, 2011 at 10:58 am

Well… go ahead, it’s a beautiful world!
You probably know more by now already ;)

Reply

17 Mary Killpatrick August 7, 2007 at 5:40 am

How do you send an e-mail to multiple recipients with mutt?

Reply

18 jidnesh_b September 8, 2011 at 12:47 pm

You can define a variable with recipient mentioned as coma separated values.

Emails=xyz@abc.com, pqr@abc.com
mutt -s “Test Mail” -a attach1 -a attach2 -a attach3 — $Emails

Reply

19 Jack September 18, 2011 at 8:52 pm

Using Vim:

Write all of the emails separated by commas to a text file, compose an email in mutt (specify yourself as the recipient), write the subject, etc. When you’re finished, write and quit, then hit E to edit the headers. Scroll down to CC: and then type :r . Your addresses should appear on the next line, so scroll to that line and hit backspace. Ta-da! Magic. :)

Reply

20 Gail October 21, 2011 at 5:33 pm

Hi experts
I would like to send e-mail using command-line-mutt; but I’d like it to read the recipients from the “To:” header in the file (in mailx, there is such an option: “-t”, like this: mailx -t < filename, and then you don't need to specify recipients on the command line). How can it be done in mutt?

Reply

21 aaron December 11, 2007 at 2:35 am

is the reading in of the text file required or can I type a one-line body from the command line?

Reply

22 Sue December 12, 2007 at 7:27 am

This is a reply to message 12, regarding using “-a” to send multiple attachments in one email.

I use the same mutt command line in my script. My challenge is I can’t hard code the files with “-a”. I need to search for all logs, find out what they are and mutt them.

I need something like:

mutt -s “log files” -a *.log sue@homtmail.com < summary

How do I code “-a *.log”?

Reply

23 Barry December 17, 2007 at 9:52 pm

Reply to #17: Regarding how to use “-a” for an indeterminate number of attachments; here’s one way:

y=””
for x in $(ls -1 *.log) ; do
y=”$y -a $x”
done

mutt -x “subject” $y myaddr@company.com < somefile

Reply

24 bhush April 3, 2008 at 6:06 am

How do you send an e-mail to multiple recipients with mutt?

Reply

25 gpsforum May 1, 2008 at 4:49 pm

In reply to 19: Putting all addresses into quotes should work.

mutt -s “My message” -a attchmnt “address1 address2″

Reply

26 macs June 5, 2008 at 6:13 am

its working well in system which serve as proxy but not working from my desk. How to get it work in a proxy ed network ?

Reply

27 Rob June 27, 2008 at 4:53 am

Thanks, I was searching for an hour for this! To do the equivalent with sendmail is crazy!

Reply

28 zyga August 27, 2008 at 1:54 pm

man mpack

Reply

29 Nokao September 16, 2008 at 5:45 am

Thank you!

Reply

30 Carlos Garcia October 27, 2008 at 6:39 pm

worked like a charm for me, thanx guys :]

Reply

31 Malath October 31, 2008 at 10:12 am

hi all, i am getting this error
mutt -s “Test Shell Mail” malath.alakeel@gmail.com < email
Error sending message, child exited 127 (Exec error.).
Could not send the message.

Reply

32 Kaniska November 1, 2008 at 7:06 pm

How to use mapck to send multiple files? i am able to send only one file with the command. Please help

Reply

33 nixCraft November 1, 2008 at 7:22 pm
34 Shamjith December 13, 2008 at 3:15 pm

Thanks

Reply

35 ace December 21, 2008 at 7:35 am

i am unable to send mail from shell .. getting an error /etc/postfic/main.cf no such file or directory ..pls help

Reply

36 EMG January 12, 2009 at 7:26 pm

I am unable to send an .htlm file as the mail body. When I use the command below, it mails the actual code.

mutt -s “Test Mail” user@uh.edu < mail_attachment.html

I can send it as an attachment and it comes through fine with this command:

mutt -s “Test Mail” -a mail_attachment.html user@uh.edu < mail_body.txt

the mail_body.txt does not contain anything. I just get the attachemnt. Sun system can e-mail it to Outlook as an .htlm mail.

Reply

37 jesper hansen January 19, 2009 at 6:52 pm

Hmmm why all this reported succes, I seem to get it all wrong.

mutt -s “test Mail” -a /home/jesper/Y.tar gvzfs@yahoo.dk < t.txt

so where am I going wrong?

I am using a laptop with wireless connection. How do I specify “from”?

Reply

38 Larry October 30, 2011 at 4:58 pm

Use mutt -e “set from=your@mail.jo” -s “test Mail” -a /home/jesper/Y.tar gvzfs@yahoo.dk < t.txt

Reply

39 Sam February 12, 2009 at 5:29 pm

Is it possible to send specific text in the body of the mail, rather than sending the body from the attached file?

mutt -s “Test Mail” -a /home/test.txt user@abc.com < “TEXT BODY”

Reply

40 tarun singhal March 4, 2009 at 10:40 am

is it possible to set “from” option, becouse by default i getting from: root
i using command like:—
mutt -s ‘Test mail’ -a file.xls usernamel@domain.com < file

i want from option should become useranem who is giving mail to someone

Reply

41 jiltin April 9, 2009 at 11:14 am

you can use uuencode too. Here is an example I used for many years. How to extract,using bash/unix/linux shell scripting, the oracle data like excel report and …-> http://tinyurl.com/dbcy98

Reply

42 Prudhvi raj May 15, 2009 at 11:47 am

Sam,
if u want to send certian text in body instead of using a body file then go for this:
#> echo -e “This is the body message of the email” | mutt -a server.key raj@alpha.xion.com -s “This is the email subject”

Reply

43 Amritesh June 18, 2009 at 12:26 pm

Actually I am using proxy server to access internet
i did
export http_proxy=”http://10.100.100.172:3128/”
and
export http_proxy=http://10.100.100.172:3128/
to configure proxy
then
mutt -s “Test mail” -a /root/amritesh/rs.txt amriteshsmsc@gmail.com < /root/amritesh/gw.txt
to send mail but it wont work plz guide me what to do…?

Reply

44 Tom July 4, 2009 at 10:31 pm

in debian lenny:
mutt -s “subject” -a file1 file2 file3 — email@gmail.com < email-text.file

between attachments and recipients need to putt double dash and files for attachment with out anything

with out double dash wroute:
"Can't stat email@gmail.com: No such file or directory
email@gmail.com: unable to attach file."

because it's thinking that email@gmail.com it's one more attachemt file )))

Hope it's help you )))

Reply

45 phil January 27, 2011 at 3:20 am

“in debian lenny:
mutt -s “subject” -a file1 file2 file3 — email@gmail.com < email-text.file

between attachments and recipients need to putt double dash and files for attachment with out anything"

same for squeeze. thanks mate

Reply

46 ram July 29, 2009 at 5:00 am

Hi,

when i am sending a mail with pdf attachment thru mailx utility on MS Outlook than it wooks fine but whenver i am sending the same to rediff/gamil/yahoo than instead of pdf attachment it is sending junk characters,please advice.
uuencode xx_file.pdf xx_file.pdf| mailx –s “Subject of mail” “mail_id”
i am using the above command.

please suggets to do the same.

ram

Reply

47 Murali September 16, 2009 at 6:07 am

Hi

This e-mail (mutt) utility looks very useful, I would like to use it on AIX, can any one let me know how I could install this utility on AIX and use it.

Thank you

Regards
Murali

Reply

48 Sanil October 6, 2009 at 5:14 am

if you want to send the contents of a text file from the shell prompt do the following.

# mail -s “subject of the mail” me@me.com < textfile.txt

Reply

49 lien October 6, 2009 at 3:36 pm

What an excellent tool. I have been looking for something like this for ages!

Reply

50 Fun Nepali Games October 13, 2009 at 9:50 pm

How to specify “from name” when sending email thru mutt? I am using php cli to send email and I could only set the “from email”, and not the “from name”. Here is my php statement with mutt command:

shell_exec(“export EMAIL=\”from@email.com\”; echo ‘email text’ | mutt -s ‘email subject’ -a ‘/attachment/file.pdf’ to@email.com“);

When I ran this php program, the recepient receives email like this:
From: “My Real Name”

But I want “My Company Name” to show in the From: line. Where to specify this when running mutt ?

Reply

51 Maroun October 26, 2009 at 2:17 pm

Hi,

I need a favor, I am using mutt command to send an email and everything is working fine, but as you know when email arrived to the proper person, the email is coming from internal name of the instance of the server (e.g From: XX@servername.companyname.extension), can we put an constanct alias for ‘from email account’, I mean from: payables@companyname.net for example. I think this is an internal linux parameters structure?

Thanks
Maroun

Reply

52 Ken November 12, 2009 at 4:16 am

Hi Fun Nepali Games/ Maroun,

Use this command format to set the from name and the from email to whatever you want:
export EMAIL=’from name<from email address>'; echo ‘email body text‘ | mutt -a ‘attachment file‘ -s ‘subjectrecipient address

Hope I helped! Greetings

Reply

53 Fun Nepali Games November 12, 2009 at 11:48 am

Hi Ken, thank you for your help. I had come up with this syntax to fix my issue.

shell_exec(”export EMAIL=\”from@email.com\”; export REPLYTO=\”from@email.com\”; echo ‘email text’ | mutt -n -e ‘set envelope_from_address=\”from@email.com\”‘ -e ‘set realname=\”My Company Name\”‘ -s ‘email subject’ -a ‘/attachment/file.pdf’ to@email.com“);

Reply

54 vrc November 15, 2009 at 3:02 am

Hi…
I am working on ubuntu. i did install mutt and when i typed mutt -s “hello” mymail@gmail.com in my terminal a nano editor came up and i manually had to proceed the process of sending the mail…finally it attached a file from my /tmp folder in which the contents were buffered and this file was sent…
i just want to automate the entire process without any human intervention…
Can someone please help me out in automating the entire process…
thanks

Reply

55 Andres Kwan November 27, 2009 at 12:35 am

Thanks guys, with your help I did solve the problem
“Can’t stat email@gmail.com: No such file or directory
email@gmail.com: unable to attach file.”

Reply

56 Paul January 17, 2010 at 1:26 am

How can you mutt only the newest file from a particular directory in a bash script?

Reply

57 lsi January 30, 2010 at 3:42 am

hey nice thread, i got this working with from field set as I desire, from a shell script as follows:

${TARGETEMAIL}="target@protected"
export EMAIL="My Name "
export REPLYTO="email@protected"
echo "body text" | mutt -e 'set envelope_from' -a /filename.gif -s "subject" ${TARGETEMAIL}

Reply

58 lsi January 30, 2010 at 3:45 am

(note, board munged code a bit, try again:

export EMAIL=”My Name “

Reply

59 lsi January 30, 2010 at 2:01 pm

attempt 3:

export EMAIL=”My Name <email@protected>”

eg. it is “My Name (less-than-sign)email@protected(greater-than-sign)”

Reply

60 Gavrilo Princep February 26, 2010 at 5:16 pm

Just spent a couple of hours working this out.

The mutt way to set the from address and name in mutt is ;

mutt -e "unmy_hdr from; my_hdr From: rmcdonald@supersize.com.au\"
-e "set realname=\"Ronald McDonald\" " \
-s "this is the subject line ... " \
-a attachmentfile.txt -a anotherFile.doc\
-- ttttoooo@toAddress.co.uk < bodyOfEmail.txt

Note that the -e “command” lets you do any set, unsets, or mutt configurations

———–

For the record, the other approaches to customising From addresses (and by extention other attributes) are as follows.

I have listed all the methods that mutt make available, though two of them don’t work.

————————————————————————–
Method 3 works, #2 half works, method #1 and 4 don’t work.


#from method #1
set use_envelope_from=yes
set envelope_from_address="muttrc@yourApparentDomain.co.uk"
# NOTE : use_from defaults to yes, so that mutt forces the from address
# ***THIS IS THE CAUSE OF PEOPLE GETTING myaccountname AS THEIR
# *** FROM ADDRESS

# from method #2 :
# use_from=no works. Now the MTA, e.g. ssmtp sets the from address
set use_from=no
# however, the set_from DOESNT WORK.
set from="set_from@yourApparentDomain.co.uk" # doesn't work

# from method #3
# this is the approach to use. See my command line example
# you must use the my_hdr to set a new from address. See 4
unmy_hdr from
my_hdr From:"fromEmailAddress@mydomain.info.us"

# from method #4 : let the MTA set the from address
# doesn't work. Mutt fails to remove the from header line.
unmy_hdr from
----------------------------------------

Reply

61 Gavrilo Princep February 26, 2010 at 5:18 pm

forgot to add, these are all edits to the /etc/Muttrc file, or your .muttrc equavalent

Reply

62 Yosi March 15, 2010 at 9:24 pm

Thanks for the article, helped me a lot. (the sending part)

Cheers,
Yosi

Reply

63 Deepak Kandpal April 8, 2010 at 8:54 am

Hi Friends…

I have a requiremnt where i need to send a mail with an attachement (pdf file) for the same i have written this code and it is getting executed without any error but still i am not receiving any mail. Please adive:

Following code is for you reference:

DATETIME=`date “+%Y%m%d%H%M%S”`
DATETIME1=`date “+%Y%m%d”`

REQUESTID=echo $1 | awk ‘{print $2}’ – | sed ‘s;FCP_REQID=;;’
USERPASS=echo $1 | awk ‘{print $3}’ – | sed ‘s;FCP_LOGIN=;;’ | sed ‘s;”;;g’
P_FILE_PATH=echo $1 | awk ‘{print $9}’ – | sed ‘s;”;;g’
P_FILE_NAME=echo $1 | awk ‘{print $10}’ – | sed ‘s;”;;g’
P_USER_EMAIL_ID=echo $1 | awk ‘{print $11}’ – | sed ‘s;”;;g’
FILE_SUB=echo $1 | awk ‘{print $12}’ – | sed ‘s;”;;g’

# “/oracle/apps/inst/apps/TEST_erpapts2/logs/appl/conc/out XXADIB_PO_STANDARD_467106_1.PDF temp1@adibdev.local testmail”
REQUESTID=123456
USERPASS=apps
P_FILE_PATH=/oracle/apps/inst/apps/TEST_erpapts2/logs/appl/conc/out
P_FILE_NAME=XXADIB_PO_STANDARD_467106_1.PDF
P_USER_EMAIL_ID=temp1@adibdev.local
FILE_SUB=testmail

echo “——————————————–”
echo “DatTime=” $DATETIME
echo “DATETIME1=” $DATETIME1
echo “REQUESTID=” $REQUESTID
echo “USERPASS=” $USERPASS
echo “——————————————–”
echo “param=” $1
echo “P_FILE_PATH=” $P_FILE_PATH
echo “P_FILE_NAME=” $P_FILE_NAME
echo “P_USER_EMAIL_ID=” $P_USER_EMAIL_ID
echo “——————————————–”
echo ” ”
echo “——————————————–”
EXIT_STATUS=0
echo $FILE_SUB
echo “——————————————–”
echo ” ”
echo “Just before sending mail..”
echo “EXIT_STATUS=” =$EXIT_STATUS
echo ” ”
echo “——————————————–”
if test $EXIT_STATUS = 0 ; then
echo “Success”
(echo “Please find the enclosed all vacancies and the details of vacacy statues. This is system generated email. Please do not reply.”;uuencode $P_FILE_PATH $FILE_SUB) | mailx -s “$FILE_SUB – on $DATETIME” $P_USER_EMAIL_ID
else
echo “Fail”
echo “——————————————–”
echo ” ”
echo “Un-successful run of the Error Log File”
echo ” ”
echo “——————————————–”
fi
echo “——————————————————-”
exit 0

Reply

64 Gavrilo Princep April 9, 2010 at 9:23 am

(1) have you considered looking at the examples in this thread ?
(2) this thread is about mutt, and you are using mailx
(3) my example above shows how to send an email of any configuration, with any attachments, from the command line, using mutt

In general, do this :
add the
line /bin/bash -x
to the start of your scripts. NOTE THE -x
Then watch the output, it will show you all the assignments. You probably have made a mistake in one of your awk assignments.
Also don’t try to be smart, doing stuff like running multiple commands in a subshell (in brackets) and then piping the result to mailx. Instead do clear, seperate steps, and write temporary files, in testing AND PRODUCTION so you can investigate what is going on. I mean you haven’t even been able to narrow the problem down to the step that is going wrong.

The answer to why this isn’t working is that, probably, your don’t have a MTA running. mutt and mailx and manyothers just manage the generation of the email, you need a MTA (mail transfer agent) like ssmtp (simple, easy, great) or exim4 (not simple, fully featured)

—-in summary: —-
use /bin/bash -x
test each intermediate step
use mutt, and copy one of the examples above.
find where the error is BEFORE you post on a forum.

Reply

65 Edmund Doyle June 1, 2010 at 12:49 am

I type in this text “$ mutt -s “Test mail” -a msg.txt amgormandoyle@gmail.com < msn.txt" and i end up with "$" is not recognized yet when i use the sample code($ mutt -s "Test mail" -a /tmp/file.tar.gz vivek@nixcraft.co.in < /tmp/mailmessage.txt) it works except for the file not specified part which was expected

Reply

66 Gavrilo Princep June 1, 2010 at 12:41 pm

It’s an idiom: the “$” is used by some people to represent the prompt character In a terminal, shorthand for I-am-typing-in-a-terminal-here. I think that they use “$” to represent the root user, and # to represent the prompt of a normal user.

Just ignore it….
…. and the rest works … right ? … cool.

Depending on permissions, doesn’t have to be a root user,

Reply

67 Oystein July 16, 2010 at 6:25 am

The other way around. # means root, $ means a normal user.

Reply

68 Edmund Doyle June 1, 2010 at 9:22 pm

Thank you for commenting however i’m begining to think that my computer doesn’t support mutt. Is this specifically for linux users because there is no mutt install link that works with my computer.

Reply

69 Jonathan Walsh July 20, 2010 at 11:56 am

What operating system is your computer running Edmund?

Reply

70 Timmy! July 20, 2010 at 4:14 pm

Ubuntu 10.04 mutt bug – add “–” after attachment, even only one file.

https://bugs.launchpad.net/ubuntu/+source/mutt/+bug/457940

Reply

71 Cybergavin September 10, 2010 at 11:21 pm

Thank you Vivek. This came handy when I realized that I didn’t have the sharutils package (for uuencode) installed and so could not use mailx/uuencode combination. Anyway, the “-a” option of mutt is better than mailx/uuencode.

Reply

72 thenoid January 29, 2011 at 1:42 am

Hey, thanks, I needed to send a quick mail and your tip worked like a charm — except I needed to send two attachments and mutt required a — before the destination. Thanks!

Reply

73 ke February 12, 2011 at 9:19 am

You enter the addresses in the two field, separated by semi-colons (;).

Reply

74 ke February 12, 2011 at 9:20 am

Well I meant “to” field instead of “two” field

Reply

75 Kalycs March 2, 2011 at 6:16 pm

Hi,
Recently I have installed Linux Ubuntu on my Laptop and was trying some command line to send emails. I do not know what package needs to be installed but same command is working fine at my work place which has Unix AIX machine.

For example this syntax is working at my work place but not working on my Ubuntu command prompt.
(echo “test”;) | mail -r from_address@gmail.com -s “Send Email ” to_address@gmail.com

Can somebody please advice what do I need to do if I want to use these above options.

Thanks in Advance

Reply

76 Bartox March 8, 2011 at 9:16 pm

I am not able to send more than ~7Mb (+ headers info which become in a 9.9 Mb file size). How can I increase the attachment size sent via mutt?. I’ve looking at the conf file and I didn’t see any line where the ~10 Mb file size attachments were set by default. I really need to increase this thing at least 25 Mb to send database backups to my email account (which supports 50 Mb attachments).

Reply

77 Edmund March 11, 2011 at 10:46 pm

Is it zipped?

Reply

78 Bartox March 15, 2011 at 2:27 am

Yes, I forgot to mention it’s a file compressed with LZMA algorithm which is the highest compression level around. My server OS is Linux/RedHat. I just need to know if mutt is capable to send bigger than ~10 MB attachment, the current backup file that I am getting is about ~7 Mb but with headers it just become into a 10 Mb. As I said I research about it, I read the config file and nothing yet.
Appreciate your help.

Reply

79 Edmund March 15, 2011 at 11:52 pm

Ha Ha Ha ! excuse me, Not laughing at you but that was just a suggestion, you obviously kno much more than me.

Reply

80 Bartox March 19, 2011 at 12:31 am

Actually I was looking at the wrong place. The attachment size limit is not controlled by mutt else the smpt server itself, in my case postfix.

If somebody is having this same issue, just go the postfix config file at /etc/postfix/main.cf (on RedHat based kernels) and look for this directive: message_size_limit (or add it to the end if it’s not in there) and just increase the value to: message_size_limit = 20480000 (20 MB for example).

Hope that helps.

Reply

81 Edmund March 15, 2011 at 11:55 pm

can this run as a portable application from a UNC path

Reply

82 Martin May 18, 2011 at 6:16 pm

Is it possible to specify a different name for an attachment than the actual file name? For instance, we have many programs the call the mutt command and send files with extensions that our recipient’s PCs don’t recognize. It would be nice to be able to rename the attachment in mutt without having to actually modify the source file.

Thanks,

Martin

Reply

83 SqueezeOJ June 18, 2011 at 3:41 pm

How do I use a Variable Subject. For example:

#!/bin/bash
mySUBJECT="No Errors in Log File"
mutt -s "$mySUBJECT" you@example.com < Nightly-Backup-Log.txt
exit 0

This always hangs and thus fails. But typing-in the same string where $mySUBJECT is works fine. Could someone tell me what I'm doing wrong?

Thanks!

Reply

84 SqueezeOJ June 18, 2011 at 3:46 pm

Answered my own question!

Need to use Single Quotes rather than Double Quotes around $mySUBJECT. For example this works:

#!/bin/bash
mySUBJECT=”No Errors in Log File”
mutt -s '$mySUBJECT' me@mycompany.com < Nightly-Backup-Log.txt
exit 0

Hope it helps someone!

Reply

85 JULIO VEIRA June 19, 2011 at 3:24 pm

The mutt program is super cool this line is part of a script I did that make a backup of all my SQL Server Info and send it to my email. Because I have a High protection for Spam this email always go to junk. I also got a POP3 account in my work and there I have no problem also I receive it in my iPhone 3GS. This is the hell of a tool. THanks for sharing this with us.

#Email will be send to my yahoo.com account.
mutt -s "MySql Server Database backup files" myemail@yahoo.com < /home/julio/dbbak/message.txt -a /home/julio/dbbak/mydbs.zip
#Email will be send to my pop3 company account.
mutt -s "MySql Server Database backup files" myemail@companypop3account.com < /home/julio/dbbak/message.txt -a /home/julio/dbbak/mydbs.zip

Reply

86 meddy July 7, 2011 at 9:21 am

hulo,i hav just instaled mutt but dont even no how to start it,how to configure it 2 read from mi email account,ani help will b apreciated\

Reply

87 rocket raja August 6, 2011 at 6:23 pm

Grr.. mutt is not working when i put my script in cron..!!

Reply

88 squeezeoj August 7, 2011 at 10:51 am

I had a similar problem: it would run from the command line while I was logged-in but running it as a cron job always failed. After some testing I decided the problem had to do with not being the same user under cron as I was at the command line. I’m not sure about the exact steps to fix it, but I’d look in that direction.

Reply

89 nate August 25, 2011 at 11:09 am

How can I get MUTT to send as an HTML email? I can attatch the html document but I want to have it viewed as soon as you look at it.. instead of seing all the text HTML tags.

Reply

90 Ajay Shilwant September 22, 2011 at 7:02 am

hi, friends….
it’s possible to add date in subject…… dynamically…..

Reply

91 Bhargav tripathi January 16, 2012 at 10:12 am

Hi,

I am using script for diskspcae in linux server and output is like alert that all team member should get mail as alert, when i install mutt i.e. up2date mutt …..command shows like temporary failure in name resolution so what should i do pls kindly help for same. ?????

Reply

92 ZachCheung August 6, 2012 at 4:29 am

When I try echo | mutt -s “foo” -a file foo@bar.com, mutt failed to send email and error output is foo@boar.com unable to attach file.
echo | mutt -s “foo” foo@bar.com -a file or echo | mutt -s “foo” -a file — foo@bar.com both works.
BTW, it’s in Debian 6.0

Reply

93 Dimon November 2, 2012 at 5:39 pm

Re: “Method 3 works, #2 half works, method #1 and 4 don’t work.”
you can’t rewrite headers when using gmail, as google violates protocol by rewriting these headers back

Reply

94 kitt January 17, 2013 at 5:55 pm

mutt -n -e ‘set envelope_from_address=\”from@email.com\”‘

Thants what i’m looking for! Thx!

Reply

95 Jon February 7, 2013 at 1:05 pm

Bingo! Took awhile to search to get this command. Mutt is poorly documented.

Reply

96 Adeyemi March 8, 2013 at 1:23 pm

Really Easy, thanks worked like a charm.

Reply

97 eldwist April 11, 2013 at 10:19 am

Hello to all,
I’ve an issue sending email with Mutt.
Command is inside a bash script and, if the email address contains an undescore _ it fail, the email sent.
If a use Mutt in the command line, it works.
I’ve no idea how to fix this problem.
Thanks in advance
Eld

Reply

98 Hemant kumar January 30, 2014 at 5:47 am

Hello,
I have faced one issue related with mutt (mailing) command on RHEL-6 server.
Issue: mutt command not able to send email to any email id from linux 6.x machine to msoutlook.
the postfix and sendmail was in installed on the server and mutt command was unable to send email. no one service will help to send the email.
Solution:
remove the postfix package on linux server and then it will work fine.
pls try this command to send attachment with mutt command
echo | mutt -s Test_mail -a --

Reply

99 Elvis April 28, 2014 at 9:30 am

I searched the web for a way to recieve mail from my Hotmail acount using Mut but no luck.
I have no problem receiving mail from my gmail acount but cant find settings that will let me download hotmail email. Anyone had any luck with Hotmail?

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Previous post:

Next post: