bugGNU Mailutils - Bugs: bug #54992, mail.mailutils ignores stdin when...


bug #54992: mail.mailutils ignores stdin when mailing attachment

Submitted by:  Johannes Martin <jmartin>
Submitted on:  Fri 09 Nov 2018 09:42:13 AM UTC  
Votes:  100  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Sergey Poznyakoff <gray>
Open/Closed:  Open

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Mon 18 Mar 2019 06:22:00 PM UTC, comment #7: 

It was fixed in 43214185092e714e0c233bf196f571bba5c17be0. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=918806#22 for details

Sergey Poznyakoff <gray>
Project AdministratorIn charge of this item.
Mon 18 Mar 2019 04:49:43 PM UTC, comment #6: 

I am using Ubuntu 18.04 LTS, GNU Mailutils 3.4 and MSMTP 1.6.6 to send an e-mail, containing an attachment, from a Bash script (and/or testing from the command line) using a GMail account for sending and another GMail account for receiving:

echo "This is the body of the e-mail" | mail address@example.com -s "This is the subject" -A /file/path/file.txt

This results in an e-mail with the attachment but no text in the body of the e-mail. If I send the same e-mail without the attachment, the text appears in the body of the e-mail.

Jason Pope <boards188>
Tue 05 Feb 2019 08:57:20 AM UTC, comment #5: 

I successfully sent a message with attachment + rfc822 text to postfix using:

echo foo | mail --content-type=application/pdf --content-filename=file.pdf --attach=file.pdf --subject="My Subject" --content-type=text/plain --alternative

But not all mailservers accept the attachment. MS Exchange seems to strip it.

Is there no way to send an attachment + text from a shell script with standard gnu mail? What am I doing wrong?

Daniel Hiepler <rigid>
Fri 09 Nov 2018 01:10:41 PM UTC, comment #4: 

The only difference between mails sent by 3.1 and 3.5 is that 3.5 always adds the Content-Disposition header and includes the
charset and name variables to the Content-Type type header of each attachment (in accordance with RFC2183 and RFC4229).

All in all, it looks as a bug-report to ME, rather than to GNU mailutils.

Sergey Poznyakoff <gray>
Project AdministratorIn charge of this item.
Fri 09 Nov 2018 12:28:53 PM UTC, comment #3: 

Sorry, it seems like this is another szenario where Microsoft Exchange messes up. When I send the mail to a non-exchange domain, it arrives fine, only when my employer's exchange server is handling the recipient domain, the contents are corrupted (body removed and replaced by copy of attachment).

I'm not sure what exactly is different in the mails that causes exchange to mess up mails sent from mailutils 3.4 and up but no those from 3.1 and below.

Johannes Martin <jmartin>
Fri 09 Nov 2018 12:16:38 PM UTC, comment #2: 

That's strange. I just downloaded mailutils 3.5 and compiled if from sources on a freshly installed debian/testing system:

From the compilation directory:
./mail/mail --version | ./mail/mail --content-type=text/plain --attach=/etc/issue -s test -email is unavailable-

Same result as with mailutils 3.5 from the debian repository (missing body).

Johannes Martin <jmartin>
Fri 09 Nov 2018 11:11:08 AM UTC, comment #1: 

Can't reproduce it with mailutils 3.5

Sergey Poznyakoff <gray>
Project AdministratorIn charge of this item.
Fri 09 Nov 2018 09:42:13 AM UTC, original submission:  

Since mailutils 3.4, mail.mailutils ignores stdin (the mail body) when an attachment is specified on the command line.

Test case:
LANG=C mail.mailutils --version | mail.mailutils --content-type=text/plain --attach=/etc/issue -s test -email is unavailable-

mailutils up to and including 3.1 sends an email with the output of mail.mailutils --version as body and the contents of /etc/issue as attachment.

mailutils from 3.4 on (also tested 3.5) sends an email with the contents of /etc/issue as both the mail body and attachment.

Tested on Ubuntu (14.04, 16.04, 18.04) and Debian (stretch, buster, sid).

The problem also occurs if stdin is a tty rather than a pipe.

Johannes Martin <jmartin>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by boards188 (Posted a comment)
  • -email is unavailable- added by rigid (Posted a comment)
  • -email is unavailable- added by rigid (Voted in favor of this item)
  • -email is unavailable- added by gray (Posted a comment)
  • -email is unavailable- added by jmartin (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 100 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-18 gray StatusWorks For Me => Fixed
    2019-02-05 rigid Carbon-Copy- => Added rigid
    2018-11-09 gray StatusNone => Works For Me
        Assigned toNone => gray

    Back to the top

    Powered by Savane 3.5