Mutt send email with attachment to personal and corporate email address

attachmentmuttsendmail

[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" sample@gmail.com

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

echo $Message | mutt -s "WARNING $Subject" sample@corp.domain

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

1> When send to personal email address (sample@gmail.com), multiple files can be attached.

echo $Message | mutt -s "NORMAL $Subject" sample@gmail.com \
     -a test1.log -a test2.log

2> When send to corporate email address (sample@corp.domain), 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" sample@corp.domain \
      -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?

Best Answer

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