Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This works:

echo "yada yada" | msmtp

but not this:

cat yadayada.txt | msmtp

which delivers the email with empty content.

Why does echo work through pipe but not cat with msmtp ?

share|improve this question
Is your yadayada.txt formatted funny or have weird permissions? It works fine for me catting it out. – nerdwaller Aug 7 '13 at 21:52
yadayada.txt has u:rw g:rw o:r and is a multiline file. sample content: === rsync start === 2013-08-07 20:58:01 === rsync stop === 2013-08-07 21:00:50 – user19496 Aug 7 '13 at 21:56
this worked: tr -d ':' < yadayada.txt | msmtp – user19496 Aug 7 '13 at 22:26
':' was the culprit. thx @nerdwaller you pointed me in the right direction. – user19496 Aug 7 '13 at 22:27
That makes sense, since msmtp allows uses of something like Subject: My subject line. Good catch! – nerdwaller Aug 7 '13 at 22:32

msmtp seems to rely on a wellformed email message in the file being read.


Subject: My subject line  
My body text

Since I don't care about Subject etc
(I'm sending an email when a logfile is modified using incron)

tr -d ':' < yadayada.txt | msmtp

is a Q&D way to get the logfile content sent using msmtp.

share|improve this answer

You must log in to answer this question.

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