0

[Mutt | CentOS 5.1] I have set up Mutt on CentOS and configured /etc/Muttrc and ~/.muttrc files. I can send email out without attachments, command:

echo $Message | mutt -s "WARNING $Subject" [email protected]

and this works well for corporate's email address, e.g.

echo $Message | mutt -s "WARNING $Subject" [email protected]

When sending email with attachments, weird results come out. I will explain in cases as below.

1> When send to personal email address ([email protected]), multiple files can be attached.

echo $Message | mutt -s "NORMAL $Subject" [email protected] \
     -a test1.log -a test2.log

2> When send to corporate email address ([email protected]), emails cannot be sent out if files attached. (cmd similar as above). But the interesting thing is, if I attach the /root/install.log FIRST, the email can be sent out with attachments, cmd as below:

echo $Message | mutt -s "NORMAL $Subject" [email protected] \
      -a /root/install.log -a test1.log -a test2.log

Case would fail to send if attachment order changed.

I cannot figure out where the problem exists from above cases, any configuration I may miss?

3 Answers 3

3

Since you are piping stuff into mutt, you must use the -x (mailx compose mode) option first.

2
  • Can you provide a full command for reference? BTW, this doesn't explain why case 1 succeeds to send email, while case 2 not.
    – Andrew
    Mar 16, 2012 at 14:24
  • echo $Message | mutt -x -s "WARNING $Subject" [email protected] You do that because mutt is a console (curses) application and you're piping something to its stdin, so it has to read from stdin.
    – adamo
    Mar 16, 2012 at 16:05
0

From mutt(1):

   -a file [...]
          Attach  a  file  to  your  message  using MIME.  When attaching single or  multiple files, separating filenames and
          recipient addresses with "--" is mandatory, e.g. mutt -a image.jpg -- addr1 or mutt  -a  img.jpg  *.png  --  addr1
          addr2.  The -a option must be placed at the end of command line options.
2
  • Do you mind provide more details and explain the different results between case 1 and 2?
    – Andrew
    Mar 16, 2012 at 14:25
  • The man page says that you should specify -a only once. Anyway, I just tried commands like: echo test | mutt -s "prova" [email protected] -a /tmp/wut.png -a /etc/motd. They work, also with gmail accounts.
    – ema
    Mar 16, 2012 at 16:47
0

I ran into this same problem today. You don't say what the error msg is, but I bet it said "can't stat unable to attach file".

This is the solution. "--" is mandatory, e.g. mutt -a image.jpg -- Note: The -a option must be placed at the end of command line options.

http://ubuntuforums.org/showthread.php?t=1586810 http://www.linuxquestions.org/questions/linux-software-2/mutt-someone@somedomain-com-unable-to-attach-file-844315/

bugs.launchpad.net /ubuntu/+source/mutt/+bug/805613

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .