I have a text file with multiple lines in content . But when I am sending it in mail all the lines are coming in one line in email as part of body of mail.

But when I insert empty line in content file "testFile" . I getting empty lines in mail which is expected, but without empty lines all lines are getting merged into single line .

I am using command in below format.

mutt -s "Subject Test Mail " user@example.com < testFile

sample testFile

this is line1
this is line2
this is line3
this is line4

Received mail as part of body

this is line1 this is line2 this is line3 this is line4 
  • This will most probably be an issue with how the client is parsing the file, stripping out the new lines. Jan 30 '18 at 13:16
  • 1
    What client is being used? Outlook I recall likes to mangle lines like that.
    – thrig
    Jan 30 '18 at 15:09

If the lines in your data file contain trailing spaces at the end of the line, the client reading program may be assuming you are using "format=flowed" mode, see rfc2646, and for example this article.

You can visualize such characters with cat -vet, and could try removing the trailing spaces or tabs with, for example, gnu sed:

sed 's/[ \t]\+$//'
  • Hi , Thank you so much for the pointer about trailing space. I have added to empty tabs in the each line and that resolved my problem . Thanks,
    – SuS
    Feb 1 '18 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.